<?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>Triggering Advanced Workflow processes in PHP customizations</title><link>/dev-club/b/dev-blog/posts/triggering-advanced-workflow-processes-in-php-customizations</link><description>An Advanced Workflow process can only be triggered once per PHP process or HTTP request. This is intended to prevent Sugar Administrators from defining infinitely looping processes. (A real catastrophe!) But what does this mean for PHP customization.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Triggering Advanced Workflow processes in PHP customizations</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/triggering-advanced-workflow-processes-in-php-customizations</link><pubDate>Tue, 31 Jul 2018 14:39:55 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:2d5d1454-f6fe-424f-85d6-58d8c3011618</guid><dc:creator>Matt Marum</dc:creator><slash:comments>1</slash:comments><description>
&lt;p&gt;You could also try to use aliases:&lt;/p&gt;&lt;pre class="language-php line-numbers"&gt;&lt;span class="keyword token"&gt;use&lt;/span&gt; &lt;span class="token package"&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;ProcessManager&lt;span class="punctuation token"&gt;\&lt;/span&gt;Registry&lt;/span&gt; &lt;span class="keyword token"&gt;as&lt;/span&gt; RegistryA&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;span class="punctuation token"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="keyword token"&gt;use&lt;/span&gt; &lt;span class="token package"&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;ProcessManager&lt;span class="punctuation token"&gt;\&lt;/span&gt;Registry&lt;/span&gt; &lt;span class="keyword token"&gt;as&lt;/span&gt; RegistryB&lt;span class="punctuation token"&gt;;&lt;/span&gt;&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;Etc.&lt;/p&gt;&lt;p&gt;This would allow you to define multiple local usages of this class within the same file (scheduledtasks.ext.php) without causing name conflicts. You would just need to make sure your alias names are unique.&lt;/p&gt;&lt;p&gt;&lt;a href="http://php.net/manual/en/language.namespaces.importing.php" rel="nofollow" target="_blank"&gt;PHP: Using namespaces: Aliasing/Importing - Manual&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=819&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Triggering Advanced Workflow processes in PHP customizations</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/triggering-advanced-workflow-processes-in-php-customizations</link><pubDate>Mon, 30 Jul 2018 16:13:52 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:2d5d1454-f6fe-424f-85d6-58d8c3011618</guid><dc:creator>Dennis Wangerin</dc:creator><slash:comments>1</slash:comments><description>
&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://sugarclub.sugarcrm.com/members/MarcelLyyra"&gt;Marcel Lyyra&lt;/a&gt;,&lt;/p&gt;&lt;p&gt;When using that workaround in the Extension framework you&amp;nbsp;need to make sure that it&amp;nbsp;the following only loaded once per file:&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;pre class="language-php line-numbers"&gt;&lt;span class="keyword token"&gt;use&lt;/span&gt; &lt;span class="token package"&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;Sugarcrm&lt;span class="punctuation token"&gt;\&lt;/span&gt;ProcessManager&lt;span class="punctuation token"&gt;\&lt;/span&gt;Registry&lt;/span&gt;&lt;span class="punctuation token"&gt;;&lt;/span&gt; &lt;br /&gt;&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span&gt;Let&amp;#39;s say you have two schedulers where you want to use it:&lt;/span&gt;&lt;/p&gt;&lt;pre class="language-none line-numbers"&gt;./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/jobA.php&lt;br /&gt;./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/jobB.php&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span&gt;If you add &lt;span&gt;&lt;em&gt;use Sugarcrm\Sugarcrm\ProcessManager\Registry; b&lt;/em&gt;&lt;/span&gt;oth of those files&amp;nbsp;would be merged into the following single file and thus cause a PHP error as you described since the same namespace is used twice:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;pre class="language-none line-numbers"&gt;custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php&lt;br /&gt;&lt;span class="line-numbers-rows"&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;span&gt;So adding this only to jobA.php should also allow to the namespace in jobB.php since both will be merged into one file&amp;nbsp;&lt;span&gt;&lt;em&gt;custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php &lt;/em&gt;&lt;/span&gt;&lt;span&gt;where the namespace would be loaded once then. This is the file that is used in the cache/ to actually run both schedulers.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Can you confirm if loading this through the Extension framework and making sure the namespace is only loaded in the first file resolves this issue?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=819&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Triggering Advanced Workflow processes in PHP customizations</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/triggering-advanced-workflow-processes-in-php-customizations</link><pubDate>Wed, 18 Jul 2018 20:08:14 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:2d5d1454-f6fe-424f-85d6-58d8c3011618</guid><dc:creator>Marcel Lyyra</dc:creator><slash:comments>0</slash:comments><description>
&lt;p&gt;I&amp;#39;m having trouble because I have several PHP codes that set a value that triggers a workflow for multiple records. As I use this same workaround on every code, it has the same Registry path, which causes them to fail as it is located at the same file. So I was advised to change the Registry name for each code. I&amp;#39;m just not very sure as how to change the Registry on the workaround lines.&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=819&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Triggering Advanced Workflow processes in PHP customizations</title><link>https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/triggering-advanced-workflow-processes-in-php-customizations</link><pubDate>Wed, 23 May 2018 13:35:51 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:2d5d1454-f6fe-424f-85d6-58d8c3011618</guid><dc:creator>Aaron Kerr</dc:creator><slash:comments>0</slash:comments><description>
&lt;p&gt;Thanks for this post! We had been banging our heads against a dev issue which made no sense for a couple of days. Fixed now.&lt;/p&gt;
&lt;img src="https://sugarclub.sugarcrm.com/aggbug?PostID=819&amp;AppID=56&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>