{"id":15438,"date":"2019-04-16T12:19:24","date_gmt":"2019-04-16T12:19:24","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=15438"},"modified":"2022-06-24T12:45:24","modified_gmt":"2022-06-24T07:15:24","slug":"call-a-workflow-on-stage-exit-of-a-last-stage-in-business-process-flow-of-dynamics-365-ce","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/04\/call-a-workflow-on-stage-exit-of-a-last-stage-in-business-process-flow-of-dynamics-365-ce\/","title":{"rendered":"Call a workflow on Stage Exit of a last stage in business process flow of Dynamics 365 CE"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p style=\"text-align: justify;\">As Dynamics 365 CRM\u2019s native feature, we can call on-demand workflows from inside a business process flow. We can configure this from the new business process flow designer, by dragging a workflow component to a process stage, or to the Global Workflows section.<\/p>\n<p style=\"text-align: justify;\">As you know, we have written a blog on <a href=\"https:\/\/www.inogic.com\/blog\/2019\/03\/connector-and-global-workflows-in-dynamics-365-business-process-flow\/\" target=\"_blank\" rel=\"noopener noreferrer\">global workflow<\/a> where we can find its basic information. In this blog, we are continuing this by exploring global workflow with detailed steps.<\/p>\n<p style=\"text-align: justify;\">An on-demand workflow from inside a business process flow executes as usual on Stage Exit of a stage <strong>but it does not work, if we call on-demand workflow from on stage exit of a last stage of business process flow.<\/strong><\/p>\n<p style=\"text-align: justify;\">When we include a workflow that we want to trigger on Stage Exit of a stage in business process flow, and that stage is the last stage in the flow, the designer gives the impression that the workflow will be triggered when that stage is completed. However, the workflow will not be triggered because a stage transition does not take place when BPF is finishing from last stage and not moving to previous stage. We will not receive a warning or error preventing us from including the workflow on that stage. When a user interacts with the business process flow, finishing or abandoning the process does not result in a stage transition, and therefore, the workflow is not triggered.<\/p>\n<p>Consider the following examples:<\/p>\n<ul>\n<li>We create a business process flow with two stages, \u201cIdentify\u201d connects to \u201cResearch,\u201d with a workflow on stage \u201cResearch,\u201d and set the trigger to Stage Exit.<\/li>\n<li>We create a business process flow with three stages, \u201cIdentify\u201d connects to \u201cResearch,\u201d then \u201cResearch\u201d branches to \u201cResolve.\u201d We include a workflow on \u201cResearch\u201d and set the trigger to Stage Exit. When condition does not match, then stage does not move to \u201cResolve.\u201d<\/li>\n<\/ul>\n<p>The workflow will not trigger in either case.<\/p>\n<p style=\"text-align: justify;\">As shown in below screen shot, on demand workflow on stage \u201cResearch,\u201d does not trigger on stage exit, when we click Finish button. My on demand workflow sets the value of <strong>Remark<\/strong> field on stage exit of \u201cResearch\u201d stage.<img decoding=\"async\" class=\"aligncenter size-full wp-image-15441\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/04\/business-process-flow-of-Dynamics-365-CE-1.png\" alt=\"business process flow of Dynamics 365 CE\" width=\"1550\" height=\"519\" \/><\/p>\n<p style=\"text-align: justify;\">To work around this issue, we have added a Global Workflow, and added the workflow which we want to trigger to it so that the workflow is triggered for the business process rather than a stage of the process.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15439\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/04\/1business-process-flow-of-Dynamics-365-CE.png\" alt=\"business process flow of Dynamics 365 CE\" width=\"1583\" height=\"763\" \/><\/p>\n<p style=\"text-align: justify;\">After updating the BPF, as shown in above image, reload the form and click \u201cFinish\u201d button on BPF, and last stage is \u201cResearch.\u201d Now workflow triggered as expected.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-15440\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/04\/2business-process-flow-of-Dynamics-365-CE.png\" alt=\"business process flow of Dynamics 365 CE\" width=\"1573\" height=\"705\" \/><\/p>\n<p style=\"text-align: justify;\">Also, we can set the trigger for a Global workflow to <strong>Process Abandoned<\/strong> or <strong>Process Completed<\/strong> to cause the workflow to trigger when a user abandons or completes the business process.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p style=\"text-align: justify;\">An on-demand workflow from inside a business process flow executes as usual on Stage Exit of a stage. However, it does not work if we call on-demand workflow from stage exit of a last stage of business process flow and finish the business process. For this we need to set the trigger for the Global workflow to <strong>Process Completed<\/strong> to cause the workflow to trigger when a user completes the business process.<\/p>\n<h2 style=\"text-align: left;\"><div class=\"su-heading su-heading-style-default su-heading-align-center\" id=\"\" style=\"font-size:15px;margin-bottom:5px\"><div class=\"su-heading-inner\">Cut short 90% of your manual work and repetitive data entry!<\/div><\/div><\/h2>\n<p style=\"text-align: left;\"><em>Get 1 Click apps and say goodbye to all repetitive data entry in CRM &#8211;<\/em><br \/>\n<em><strong><a href=\"https:\/\/bit.ly\/3oH7dYw\" target=\"_blank\" rel=\"noopener noreferrer\">Click2Clone<\/a> <\/strong>\u2013 Clone\/Copy Dynamics 365 CRM records in 1 Click<\/em><br \/>\n<em><strong><a href=\"https:\/\/bit.ly\/3EPjAYc\" target=\"_blank\" rel=\"noopener noreferrer\">Click2Export<\/a><\/strong> \u2013 Export Dynamics 365 CRM Report\/CRM Views\/Word\/Excel template in 1 Click<\/em><br \/>\n<em><strong><a href=\"https:\/\/bit.ly\/3EN8h2v\" target=\"_blank\" rel=\"noopener noreferrer\">Click2Undo<\/a><\/strong> \u2013 Undo &amp; Restore Dynamics 365 CRM data in 1 Click<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction As Dynamics 365 CRM\u2019s native feature, we can call on-demand workflows from inside a business process flow. We can configure this from the new business process flow designer, by dragging a workflow component to a process stage, or to the Global Workflows section. As you know, we have written a blog on global workflow\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/04\/call-a-workflow-on-stage-exit-of-a-last-stage-in-business-process-flow-of-dynamics-365-ce\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":18203,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6,67],"tags":[229,545],"class_list":["post-15438","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-process-flows","category-workflows","tag-business-process-flows","tag-dynamics-365-crm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/15438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=15438"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/15438\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/18203"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=15438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=15438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=15438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}