{"id":24241,"date":"2020-07-28T07:38:53","date_gmt":"2020-07-28T07:38:53","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=24241"},"modified":"2020-07-28T07:38:53","modified_gmt":"2020-07-28T07:38:53","slug":"identify-the-trigger-message-when-using-common-data-service-current-connector-in-power-automate-flows","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2020\/07\/identify-the-trigger-message-when-using-common-data-service-current-connector-in-power-automate-flows\/","title":{"rendered":"Identify the trigger message when using Common Data Service (Current) Connector in Power Automate Flows"},"content":{"rendered":"<p>The earlier versions of the D365 Connector or the Common Data Service connector provided separate triggers for each of the CRUD actions like Create, Update and Delete. The latest version of the connector Common Data Service (Current) which is the one we should be using moving forward in most cases provides a single trigger as can be seen in the screenshot below<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-24231\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate.png\" alt=\"Power Automate\" width=\"1042\" height=\"467\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate.png 1042w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate-300x134.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate-768x344.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate-1024x459.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1Power-Automate-660x296.png 660w\" sizes=\"(max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<p>Once you choose this trigger, you are then allowed to choose from the various combinations of trigger conditions supported<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24232\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/flow.png\" alt=\"Power Automate\" width=\"976\" height=\"368\" \/><\/p>\n<p>This was a good improvement over the previous versions of the connectors because quite often we have similar logic to be executed upon Create or Update and now with the ability to combine these two trigger conditions, we can have a single flow designed to cover both the scenarios.<\/p>\n<p>In one of the projects we came across a scenario where in addition to the common logic to be executed for both Create and Update operation, there was one piece of logic specific to Update action.<\/p>\n<p>And there came the need to be able to identify the action that invoked the flow \u201cCreate\u201d or \u201cUpdate\u201d.<\/p>\n<p>While the dynamic values listing does not provide this information directly, looking at the output body from the test execution, we found that it does share this information<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24233\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3Power-Automate.png\" alt=\"Power Automate\" width=\"992\" height=\"447\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3Power-Automate.png 840w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3Power-Automate-300x135.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3Power-Automate-768x346.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3Power-Automate-660x297.png 660w\" sizes=\"(max-width: 992px) 100vw, 992px\" \/><\/p>\n<p>To use this value, choose to add expression (click on fx button) to bring up the below screen<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24234\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/1-flow.png\" alt=\"Power Automate\" width=\"978\" height=\"456\" \/><\/p>\n<p>Choose the first dynamic value listed as part of your operation output \u2013 Account Name in my case<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-24235\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/2flow.png\" alt=\"Power Automate\" width=\"966\" height=\"392\" \/><\/p>\n<p>Now replace \u201cname\u201d in the above with \u201cSdkMessage\u201d and your expression should now look like<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-24246\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow.png\" alt=\"\" width=\"1402\" height=\"300\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow.png 1402w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow-300x64.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow-768x164.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow-1024x219.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/3flow-660x141.png 660w\" sizes=\"(max-width: 1402px) 100vw, 1402px\" \/><\/p>\n<p>Add the message names as the cases for Switch operation<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-24247\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow.png\" alt=\"\" width=\"1968\" height=\"718\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow.png 1968w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow-300x109.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow-768x280.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow-1024x374.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/4flow-660x241.png 660w\" sizes=\"(max-width: 1968px) 100vw, 1968px\" \/><\/p>\n<p>Note: If your flow designer experience does not list out dynamic values as shown in the screenshots above, make sure to enable the new Experimental features for Power Automate<\/p>\n<p>Navigate to Setting <img decoding=\"async\" class=\"wp-image-24248 alignmiddle\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/5flow.png\" alt=\"\" width=\"17\" height=\"17\" \/> -&gt; View all Power Automate Settings to bring up the following screen<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-24249\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/6flow.png\" alt=\"\" width=\"391\" height=\"611\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/6flow.png 680w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/6flow-192x300.png 192w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/6flow-656x1024.png 656w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/07\/6flow-660x1031.png 660w\" sizes=\"(max-width: 391px) 100vw, 391px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>Have a look at the payload that is returned as part of the trigger output \u2013 you might find values being returned that have not been exposed as Dynamic Values but could still be used by defining appropriate expressions for them.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The earlier versions of the D365 Connector or the Common Data Service connector provided separate triggers for each of the CRUD actions like Create, Update and Delete. The latest version of the connector Common Data Service (Current) which is the one we should be using moving forward in most cases provides a single trigger as\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2020\/07\/identify-the-trigger-message-when-using-common-data-service-current-connector-in-power-automate-flows\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":24253,"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":[9,18,1985],"tags":[],"class_list":["post-24241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-common-data-service","category-dynamics-365-v9-2","category-power-automate"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/24241","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=24241"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/24241\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/24253"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=24241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=24241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=24241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}