{"id":10624,"date":"2025-04-26T05:47:57","date_gmt":"2025-04-26T05:47:57","guid":{"rendered":"https:\/\/www.aegissofttech.com\/insights\/?p=10624"},"modified":"2025-10-29T11:49:39","modified_gmt":"2025-10-29T11:49:39","slug":"power-automate-detect-dynamics-crm-operations","status":"publish","type":"post","link":"https:\/\/www.aegissofttech.com\/insights\/power-automate-detect-dynamics-crm-operations\/","title":{"rendered":"Create\/Update\/Delete Dynamics CRM Operation in a Power-Automate Flow Dynamically"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>INTRODUCTION<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This quick guide explains an easy and effective way to figure out whether a Dataverse-triggered Power Automate flow is running because of a <strong>Create, Update, or Delete<\/strong> action in <a href=\"https:\/\/www.aegissofttech.com\/dynamics-365\/crm\" data-type=\"link\" data-id=\"https:\/\/www.aegissofttech.com\/dynamics-365\/crm\">Microsoft Dynamics 365 CRM Solutions<\/a>. By capturing the <strong><em>sdkmessage<\/em><\/strong> value from the trigger\u2019s output, we can clearly identify what kind of operation started the flow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With this method, used frequently by experienced <strong><a href=\"https:\/\/www.aegissofttech.com\/dynamics-365\/crm\">Dynamics 365 CRM consultants<\/a><\/strong>, we can build more intelligent flows that adjust their steps based on the type of change made to a record. It helps reduce the need for multiple separate flows and gives us better control and flexibility when automating business logic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><em>STEPS<\/em><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. To begin with, we create a new Power-Automate cloud flow, setting the Dataverse trigger to \u2013 \u201c<em>When a row is added, modified or deleted<\/em>\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"420\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted-1024x420.jpg\" alt=\"added, modified or deleted\" class=\"wp-image-10625\" title=\"added, modified or deleted\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted-1024x420.jpg 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted-300x123.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted-768x315.jpg 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted-1536x630.jpg 1536w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/added-modified-or-deleted.jpg 1779w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2. After naming the flow as per its intended relevance, we set the table name = Accounts in the trigger. We specify that in the case of the UPDATE operation, the flow must trigger only when the name of an Account is updated.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"362\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/Accounts-in-the-trigger-1024x362.jpg\" alt=\"Accounts in the trigger\" class=\"wp-image-10626\" title=\"Accounts in the trigger\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/Accounts-in-the-trigger-1024x362.jpg 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/Accounts-in-the-trigger-300x106.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/Accounts-in-the-trigger-768x271.jpg 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/Accounts-in-the-trigger.jpg 1365w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3. We then initialize a variable named varSdkMessage to <strong><em>triggerOutputs()?[\u2018body\/sdkmessage\u2019]<\/em>,<\/strong> that is, to the SDK Message property of the output body of the above trigger.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"782\" height=\"644\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/triggerOutputs.jpg\" alt=\"triggerOutputs\" class=\"wp-image-10627\" title=\"triggerOutputs\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/triggerOutputs.jpg 782w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/triggerOutputs-300x247.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/triggerOutputs-768x632.jpg 768w\" sizes=\"(max-width: 782px) 100vw, 782px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4. We save these customizations of the Flow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>UNIT TESTING<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We navigate to our Dynamics 365 CE\/CRM (Dataverse) environment and create a new Account row.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"506\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/create-a-new-Account-row.jpg\" alt=\"create a new Account row\" class=\"wp-image-10628\" title=\"create a new Account row\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/create-a-new-Account-row.jpg 790w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/create-a-new-Account-row-300x192.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/create-a-new-Account-row-768x492.jpg 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We verify that our flow is executed successfully and the variable varSdkMessage is initialized correctly with the value \u201cCREATE\u201d.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"571\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/varSdkMessage-1024x571.jpg\" alt=\"varSdkMessage\" class=\"wp-image-10629\" style=\"width:1024px;height:auto\" title=\"varSdkMessage\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/varSdkMessage-1024x571.jpg 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/varSdkMessage-300x167.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/varSdkMessage-768x428.jpg 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/varSdkMessage.jpg 1390w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Next, we update the name of the account that we created and confirm that this UPDATE operation is also captured in our flow as desired.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"314\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation.jpg\" alt=\"UPDATE operation\" class=\"wp-image-10630\" title=\"UPDATE operation\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation.jpg 502w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation-300x188.jpg 300w\" sizes=\"(max-width: 502px) 100vw, 502px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"817\" height=\"679\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation2.jpg\" alt=\"\" class=\"wp-image-10631\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation2.jpg 817w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation2-300x249.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/UPDATE-operation2-768x638.jpg 768w\" sizes=\"(max-width: 817px) 100vw, 817px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>And finally, we delete the account and confirm that this DELETE operation also triggers the flow and initializes the variable to \u201cDelete\u201d SDK message.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"585\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/DELETE-operation.jpg\" alt=\"DELETE operation\" class=\"wp-image-10632\" title=\"DELETE operation\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/DELETE-operation.jpg 790w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/DELETE-operation-300x222.jpg 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2025\/04\/DELETE-operation-768x569.jpg 768w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>CONCLUSION<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Being able to identify the exact type of CRM operation that started a flow plays a key role in building smart and adaptable automations. Whether it&#8217;s sending specific email alerts, updating related records, logging activity for audits, or triggering different actions in external systems \u2014 this approach makes it easy to fine-tune how the flow behaves.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s a practical solution that fits into many everyday use cases \u2014 like applying different logic for new records vs updates, skipping steps when something is deleted, or handling errors in a more targeted way. Best of all, it\u2019s quick to implement and works seamlessly within any Dataverse-<a href=\"https:\/\/www.aegissofttech.com\/insights\/power-automate-flow-with-javascript-dynamics-365\/\" target=\"_blank\" rel=\"noreferrer noopener\">triggered Power Automate flow<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":" ","protected":false},"author":11,"featured_media":10633,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[19],"tags":[1445],"class_list":["post-10624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","tag-power-automate-dynamics-365-flow"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/10624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/comments?post=10624"}],"version-history":[{"count":5,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/10624\/revisions"}],"predecessor-version":[{"id":13813,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/10624\/revisions\/13813"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media\/10633"}],"wp:attachment":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media?parent=10624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/categories?post=10624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/tags?post=10624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}