{"id":26593,"date":"2021-01-25T12:55:31","date_gmt":"2021-01-25T12:55:31","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=26593"},"modified":"2025-01-16T11:43:32","modified_gmt":"2025-01-16T06:13:32","slug":"how-to-set-owner-field-dynamically-using-power-automate-cds-connector-current-environment","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2021\/01\/how-to-set-owner-field-dynamically-using-power-automate-cds-connector-current-environment\/","title":{"rendered":"How to set Owner field dynamically using Power Automate CDS Connector (Current Environment)"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>We previously experienced <a href=\"https:\/\/www.inogic.com\/blog\/2020\/10\/how-to-set-or-map-null-value-in-lookup-field-using-power-automate-cds-connector-current-environment\/\">How to set or map null values in the Lookup Field using Power Automate CDS Connector<\/a>. Let us explore How to set the Owner field dynamically using <a href=\"https:\/\/www.inogic.com\/services\/microsoft-power-platform\/microsoft-power-automate\/?utm_source=inogic-t-blog&amp;utm_medium=power-automate&amp;utm_campaign=itblog&amp;utm_id=power-automate\" target=\"_blank\" rel=\"noopener\">Power Automate<\/a>.<\/p>\n<p><strong>Scenario:\u00a0<\/strong>On the Contact entity, there exists an owner field and we want to set the same owner (which can be a user or a team) on the Opportunity entity while creating a new Opportunity. As we know how to set the lookup field, setting the Owner field is quite tricky. We need to add some extra effort with additional expressions while mapping the owner field since the owner can be a User or Team. Thus, an expression based on the selected User or Team in the Owner field needs to be written.<\/p>\n<p><strong>Mapping the owner field of opportunity with the Owner field of Contact:<\/strong><\/p>\n<p>We created a Power Automate which will get triggered on the update of the Contact entity record as shown below.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/1-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-26598 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/1-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" alt=\"set Owner field dynamically using Power Automate CDS Connector\" width=\"497\" height=\"192\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/1-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg 497w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/1-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector-300x116.jpeg 300w\" sizes=\"(max-width: 497px) 100vw, 497px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/2-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-26599 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/2-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" alt=\"\" width=\"495\" height=\"193\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/2-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg 495w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/2-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector-300x117.jpeg 300w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p>1- Then we have added Create action to Create Opportunity entity record as shown below using CDS(Current Environment).<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/3-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-26600 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/3-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" alt=\"\" width=\"452\" height=\"263\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/3-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg 452w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/3-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector-300x175.jpeg 300w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/4-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-26601 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/4-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" alt=\"set Owner field dynamically using Power Automate CDS Connector\" width=\"526\" height=\"250\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/4-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg 526w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/4-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector-300x143.jpeg 300w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/a><\/p>\n<p>2- To set the owner field, we need to add the below expression in the Owner field mapping as shown below.<\/p>\n<p><strong><u>Expression: <\/u><\/strong>if(equals(triggerOutputs()?[&#8216;body\/_ownerid_value@Microsoft.Dynamics.CRM.lookuplogicalname&#8217;],&#8217;systemuser&#8217;),concat(&#8216;systemusers(&#8216;, triggerOutputs()?[&#8216;body\/_ownerid_value&#8217;],&#8217;)&#8217;),concat(&#8216;teams(&#8216;, triggerOutputs()?[&#8216;body\/_ownerid_value&#8217;],&#8217;)&#8217;))<\/p>\n<p style=\"text-align: justify;\">In the above expression, we are checking the Owner field type i.e. User or Team in equal() function using \u201c<strong><em>_ownerid_value@Microsoft.Dynamics.CRM.lookuplogicalname<\/em><\/strong><em>\u201d<\/em>.<\/p>\n<p style=\"text-align: justify;\">The \u201c<em>Microsoft.Dynamics.CRM.lookuplogicalname\u201d<\/em> returns the logical name of the User or Team entity.<\/p>\n<p style=\"text-align: justify;\">We need to concat \u201cEntitySetName\u201d and \u201cGuid\u201d of the record i.e. systemusers(&lt;guid&gt;) or teams(&lt;guid&gt;).<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/5-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-26602 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/5-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg\" alt=\"set Owner field dynamically using Power Automate CDS Connector\" width=\"570\" height=\"173\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/5-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector.jpeg 570w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/01\/5-set-Owner-field-dynamically-using-Power-Automate-CDS-Connector-300x91.jpeg 300w\" sizes=\"(max-width: 570px) 100vw, 570px\" \/><\/a><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>Using the above solution, we can set the Owner field dynamically using Power Automate CDS Connector (Current Environment).<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-35939\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2023\/09\/Microsoft-Power-Platform.gif\" alt=\"Microsoft Power Platform\" width=\"800\" height=\"200\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction We previously experienced How to set or map null values in the Lookup Field using Power Automate CDS Connector. Let us explore How to set the Owner field dynamically using Power Automate. Scenario:\u00a0On the Contact entity, there exists an owner field and we want to set the same owner (which can be a user\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2021\/01\/how-to-set-owner-field-dynamically-using-power-automate-cds-connector-current-environment\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"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":[16,19,44,1985],"tags":[2590,2135,2171,2007,1975,2134,2589],"class_list":["post-26593","post","type-post","status-publish","format-standard","hentry","category-dynamics-365","category-dynamics-crm","category-power-apps","category-power-automate","tag-canvas-apps-more","tag-cds-connector","tag-dataverse","tag-dynamics-365-power-automate","tag-power-automate","tag-set-owner-field-dynamically","tag-top-blogs-of-2021-power-apps"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/26593","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=26593"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/26593\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=26593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=26593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=26593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}