How to programatically check when a Lead is convert and check all Process sugar do?

Hi All, 

I have few issues on lead conversion and I we are puzzled , I want to  understand how does its processes ,  What are the steps taken to convert a Lead. is there any Diagrams? 

Anything that tells us what is the process and the order the logic hooks triggers ?

  • Hi Rodrigo,

    are you trying to solve a particular problem with the Lead conversion?

    Much of what happens depends on your Lead conversion settings and whether you are creating new records or linking existing ones during the conversion process. Of course there are also those of us who have customized the process which may complicate things.

    The key to Logic hooks is when things are saved and the four most basic and most common ones are: before save, after save, before relationship add, after relationship add.

    Both records need to exist and have an id before a relationship can be added between them which means that if you are creating a new record it needs to be saved first.

    So if you are creating, for example, a new Contact  as part of the lead conversion then the Contact is saved before the relationship with the Lead is established. The logic hook order will be:

    before save
    after save
    before relationship add
    after relationship add

    Of course you can have multiple actions in each of those logic hook categories and the order there is established by the array numbering in the logic_hooks.php file in the module in question.

    Relationship logic hooks can be defined in either module.
    I am not 100% sure about the precedence when there is, for example, a before relationship add on the Lead and one on the Contact, both will be triggered and one would assume that the developer would take care not to double up, I suspect the key to which triggers first would depend on which side of the relationship you are working on: that is are you linking the Lead to the Contact or the Contact to the Lead (subtle difference there).

    In the lead conversion process the function setRelationshipsForModulesToContacts triggers the addition of the relationship from the Contact to the Lead and therefore I would think that the order of execution would be:

    before relationship add logic hooks defined in Contacts
    before relationship add logic hooks defined on the Lead
    after relationship add logic hooks on the Contact
    after relationship add logic hooks on the Lead.

    Does that answer your question?


  • Thank you for time on explain the process, I really appreciate.

Reply Children
No Data