Convert to

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Russ
    Senior Member
    • Feb 2022
    • 423

    Convert to

    Hey guys, question, how do I add / remove entities from the lead "Convert" button on the lead?
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    you can't add / remove entities from the lead Convert button one way to remove them is to go to entity manager > account > layouts > convert Lead and then just make sure that you don't include any any fields there, same goes for opportunities and contacts. Otherwise you could create a custom convert to logic to override the existing one.
    Rabii
    Web Dev

    Comment

    • Russ
      Senior Member
      • Feb 2022
      • 423

      #3
      Originally posted by rabii
      you can't add / remove entities from the lead Convert button one way to remove them is to go to entity manager > account > layouts > convert Lead and then just make sure that you don't include any any fields there, same goes for opportunities and contacts. Otherwise you could create a custom convert to logic to override the existing one.
      Hi, thanks,
      1. I tried to remove Account from Lead conversion, but it is not allowing me to delete all fields from the layout (screen attached)
      2. I am trying to add a custom entity to a lead conversion, can't add it since there is no such option on the "Entity manager"
      Attached Files

      Comment

      • Russ
        Senior Member
        • Feb 2022
        • 423

        #4
        And one more question (secondary), how can I restrict a conversion in such a way, if "Opportunity" was selected, "Contact" must be as well, no way to bypass it

        Comment

        • rabii
          Active Community Member
          • Jun 2016
          • 1250

          #5
          Hey Russ

          I have doubled checked and it seems that it is possible to add / remove scopes to the convert button of the lead, below is an expample on how to add Case to the convert button:

          1 - Create a new file if doesn't exist under custom\Espo\Custom\Resources\metadata\entityDefs\L ead.json and paste the code below: (Use only one of the two code - each code below represent a Lead.json file)

          PHP Code:
          // Use this code if you want to only add more entities e.g below i have added Case to the existing list using (Append)
          // // convertFields is used to map the fields between the converted entity and the lead (name of the case) => accountName of the Lead
          {
              "convertEntityList": [
                  "__APPEND__",
                  "Case"
              ],
              "convertFields": {
                  "Case": {
                       "name": "accountName"
                  }
              }
          }
          
          // Use this code if you want to override existing list and remove entities e.g below i have removed opportunity and added Case
          // convertFields is used to map the fields between the converted entity and the lead (name of the case) => accountName of the Lead
          {
              "convertEntityList": [
                  "Account",
                  "Contact",
                  "Case"
              ],
              "convertFields": {
                  "Case": {
                       "name": "accountName"
                  }
              }
          }


          2 - Create a detailConvert.json under custom\Espo\Custom\Resources\layouts\Case and paste into the code below (you need to customise this to show the correct field you want to use for the conversion), in example below i am using only name and description but you can customise it to your need:

          PHP Code:
          [
              {
                  "label":"Overview",
                  "rows":[
                      [{"name":"name"},false]
                  ]
              }, {
                  "label":"Details",
                  "rows":[
                      [{"name":"description", "fullWidth": true}]
                  ]
              }
          ]

          If you follow that then just clear the cache and rebuild the system and you should see the Case in the conversion list entity when you click on convert.

          As per your question about making one entity required based on selection of another i think it is possible but require some code adjustment. will see if i come up with something i will share with you.

          I hope this helps.

          Cheers
          Last edited by rabii; 06-10-2024, 08:11 AM.
          Rabii
          Web Dev

          Comment

          • Russ
            Senior Member
            • Feb 2022
            • 423

            #6
            Thanks a lot rabii, I will try, so you example shows how to add an entity, how do we remove one? Let's say "Account"?

            Comment

            • Russ
              Senior Member
              • Feb 2022
              • 423

              #7
              Originally posted by Russ
              Thanks a lot rabii, I will try, so you example shows how to add an entity, how do we remove one? Let's say "Account"?
              Oh, sorry, my bad, I see in your code comment:
              // Use this code if you want to override existing list and remove entities e.g below i have removed opportunity and added Case


              Thanks

              Comment

              • Russ
                Senior Member
                • Feb 2022
                • 423

                #8
                >As per your question about making one entity required based on selection of another i think it is possible but require some code adjustment. will see if i come up with something i will share with you.


                Thanks

                Comment

                • ChrisSka83
                  Senior Member
                  • Apr 2023
                  • 197

                  #9
                  There is a small error in rabii post.
                  The file should be called -> detailConvert.json​

                  Hey guys, question, how do I add / remove entities from the lead "Convert" button on the lead?

                  Comment


                  • rabii
                    rabii commented
                    Editing a comment
                    Thanks
                    I have changed the name of the file
                • sunil123!
                  Junior Member
                  • Aug 2024
                  • 2

                  #10
                  Is it possible to write custom logic for convert but in lead to convert screen,
                  Example: when I check the customer and click on convert button customer will be created, after created using customer id to create another entity.

                  If possible how to create custom logic and in which folder path that need to place that javascript file, and how to add in view in lead.json file.

                  Comment

                  • sunil123!
                    Junior Member
                    • Aug 2024
                    • 2

                    #11
                    Originally posted by sunil123!
                    Is it possible to write custom logic for convert button in lead to convert screen,
                    Example: when I check the customer and click on convert button customer will be created, after created using customer id to create another entity.

                    If possible how to create custom logic and in which folder path that need to place that javascript file, and how to add in view in lead.json file.
                    Please help to solve this

                    Comment

                    Working...