<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarcrm.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Execute LogicHook after Workflow</title><link>https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/1855/execute-logichook-after-workflow</link><description>I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Execute LogicHook after Workflow</title><link>https://sugarclub.sugarcrm.com/thread/7094?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2019 08:19:10 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:cdebbf9b-bd72-4ebc-a094-0aaf1029220a</guid><dc:creator>Rolustech Support</dc:creator><description>&lt;p&gt;&lt;span style="color:#222222;background-color:#ffffff;font-size:small;"&gt;Hi David,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#222222;background-color:#ffffff;font-size:small;"&gt;Workflow&amp;nbsp;&lt;span style="font-size:small;"&gt;executes on &amp;quot;before save&amp;quot; logic hook by default. So whenever an &amp;quot;after save&amp;quot; logic hook calls with processing order 1, firstly workflow executes and then after_save logic hook.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#222222;background-color:#ffffff;font-size:small;"&gt;We&amp;nbsp;&lt;span style="font-size:small;"&gt;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 &amp;#39;locked_field_bean_rel&amp;#39; 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.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#222222;background-color:#ffffff;font-size:small;"&gt;So,&amp;nbsp;&lt;span style="font-size:small;"&gt;it can say that after_save logic hook calls 2 times, once during the execution of the workflow(to maintain an entry in the &amp;#39;locked_field_bean_rel&amp;#39; table) and later when the workflow has done with its processing.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color:#ffffff;color:#222222;font-size:small;"&gt;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.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color:#ffffff;color:#222222;font-size:small;"&gt;Kind Regards,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color:#ffffff;color:#222222;font-size:small;"&gt;Rolustech Support&lt;br /&gt;&lt;span&gt;Email: &lt;/span&gt;&lt;a href="mailto:support@rolustech.com"&gt;support@rolustech.com&lt;/a&gt;&lt;br /&gt;Website: www.rolustech.com&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>