Convert to

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • sunil123!
    replied
    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

    Leave a comment:


  • sunil123!
    replied
    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.

    Leave a comment:


  • rabii
    commented on 's reply
    Thanks
    I have changed the name of the file

  • ChrisSka83
    replied
    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?

    Leave a comment:


  • Russ
    replied
    >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

    Leave a comment:


  • Russ
    replied
    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

    Leave a comment:


  • Russ
    replied
    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"?

    Leave a comment:


  • rabii
    replied
    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.

    Leave a comment:


  • Russ
    replied
    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

    Leave a comment:


  • Russ
    replied
    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

    Leave a comment:


  • rabii
    replied
    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.

    Leave a comment:


  • Russ
    started a topic Convert to

    Convert to

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