Execute LogicHook after Workflow

I'm trying to execute an after save logic hook after a workflow have run, but it keeps getting executed before

I read in another question that workflows execute as logic hooks with a processing order of 100, so I changed the processing order of my Logic Hook to 101 but that didn't seem to work either 

Parents
  • Hi David,

    Workflow executes on "before save" logic hook by default. So whenever an "after save" logic hook calls with processing order 1, firstly workflow executes and then after_save logic hook.

    We get your point about why you are facing this, for this let us elaborate its detail. When SugarBPM Process Definition is created to take action on a record, it creates an entry (relationship) in the 'locked_field_bean_rel' table, at this time after_save logic hooks also calls because of the entry in this table. This table is a special table designed to prevent changes to a record while a Process Definition is acting on a given record. Once the Process Definition has completed, this entry is then marked as deleted.

    So, it can say that after_save logic hook calls 2 times, once during the execution of the workflow(to maintain an entry in the 'locked_field_bean_rel' table) and later when the workflow has done with its processing.

    To prevent this behavior you can check the $arguments in after_save and from here you get the information about Process Definition in related_module and you can differentiate which logic_hook occurs from the existing module and which one from a workflow.

    Kind Regards,

    Rolustech Support
    Email: support@rolustech.com
    Website: www.rolustech.com

Reply
  • Hi David,

    Workflow executes on "before save" logic hook by default. So whenever an "after save" logic hook calls with processing order 1, firstly workflow executes and then after_save logic hook.

    We get your point about why you are facing this, for this let us elaborate its detail. When SugarBPM Process Definition is created to take action on a record, it creates an entry (relationship) in the 'locked_field_bean_rel' table, at this time after_save logic hooks also calls because of the entry in this table. This table is a special table designed to prevent changes to a record while a Process Definition is acting on a given record. Once the Process Definition has completed, this entry is then marked as deleted.

    So, it can say that after_save logic hook calls 2 times, once during the execution of the workflow(to maintain an entry in the 'locked_field_bean_rel' table) and later when the workflow has done with its processing.

    To prevent this behavior you can check the $arguments in after_save and from here you get the information about Process Definition in related_module and you can differentiate which logic_hook occurs from the existing module and which one from a workflow.

    Kind Regards,

    Rolustech Support
    Email: support@rolustech.com
    Website: www.rolustech.com

Children
No Data