{"id":4776,"date":"2017-03-15T16:43:17","date_gmt":"2017-03-15T11:13:17","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=4776"},"modified":"2022-06-24T15:15:44","modified_gmt":"2022-06-24T09:45:44","slug":"using-entity-reference-output-parameter-in-workflow-assembly","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/03\/using-entity-reference-output-parameter-in-workflow-assembly\/","title":{"rendered":"Using Entity Reference Output Parameter in Workflow Assembly"},"content":{"rendered":"<p><strong>Introduction:<\/strong><\/p>\n<p style=\"text-align: justify;\">Workflows in Dynamics CRM (now known as Process in Dynamics 365) allow users to create and manage automated business processes. It can be used to update entity records or related entity records. Using the OOB Workflow we can only update records which are accessible under the Workflow context.<\/p>\n<p style=\"text-align: justify;\">If you want to update any other record which is not in the context of this workflow or not related to the record under which the Workflow is executed, then you need to write a custom assembly and update the record under the custom assembly.<\/p>\n<p style=\"text-align: justify;\">There is an alternate way to update any record by using the same steps as you would follow to update the record using OOB workflow. It can be achieved by setting up the output parameter of the custom assembly.<\/p>\n<blockquote>\n<p style=\"text-align: justify;\"><strong><em>Note: The output parameter type should be EntityReference.<\/em><\/strong><\/p>\n<\/blockquote>\n<p style=\"text-align: justify;\"><strong>Steps to update entity record by using custom assembly output parameter:<\/strong><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a01. Write a custom assembly and set the output parameter type as \u2018EntityReference\u2019 as shown in the code snippet. The Output parameter should point to the record that you want to update.<\/p>\n<pre class=\"lang:default decode:true \">\/\/Update Record by using Custom Assembly output parameter\r\naccountRef = new EntityReference(\"account\", new Guid(\"475B158C-541C-E511-80D3-3863BB347BA8\"));\r\nOutPutParameterName.SetValue(executionContext, accountRef);\r\n<\/pre>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a02. Create and Register a custom assembly on CRM environment then and create an OOB workflow.<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a03. Now add a step to this OOB workflow and select the custom assembly that was created and registered in the above steps, as seen in the screenshot below;<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-1.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-4772 size-full\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-1.jpg\" alt=\"Using Entity Reference Output Parameter in Workflow Assembly\" width=\"574\" height=\"355\" \/><\/a><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a04. Now add a step \u2018Update Record\u2019 and click on the dropdown to select the Entity you want to update. You can also see a heading <strong>Entities Created By Steps<\/strong> and under this heading, you have a subheading to get the output parameter reference as seen in the screenshot below;<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-2.jpg\"><img decoding=\"async\" class=\"wp-image-4773 size-full aligncenter\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-2.jpg\" alt=\"Using Entity Reference Output Parameter in Workflow Assembly\" width=\"626\" height=\"259\" \/><\/a><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a05. Once you have selected the output parameter as shown in above screenshot, click on the \u2018Set Properties\u2019 button as seen in the screenshot below;<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-3.jpg\"><img decoding=\"async\" class=\"wp-image-4774 size-full aligncenter\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-3.jpg\" alt=\"Using Entity Reference Output Parameter in Workflow Assembly 3\" width=\"441\" height=\"206\" \/><\/a><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">\u00a06. Once you click on the button, a window is opened where you can set the fields you want to update. Click on \u2018Save and Close\u2019.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-4.jpg\"><img decoding=\"async\" class=\"wp-image-4775 size-full aligncenter\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/03\/Using-Entity-Reference-Output-Parameter-in-Workflow-Assembly-4.jpg\" alt=\"Using Entity Reference Output Parameter in Workflow Assembly\" width=\"585\" height=\"319\" \/><\/a><\/p>\n<p><strong>Conclusion:<\/strong><\/p>\n<p style=\"text-align: justify;\">By using entityreference output parameter in the custom assembly, you can easily update a record as you would do it with the OOB workflow functionality.<\/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:\/\/www.inogic.com\/product\/productivity-apps\/click-2-clone-microsoft-dynamics-crm-records\" 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:\/\/www.inogic.com\/product\/productivity-apps\/click-2-export-microsoft-dynamics-crm-reports\" 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:\/\/www.inogic.com\/product\/productivity-apps\/undo-restore-recover-deleted-dynamics-365-crm-records\" 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: Workflows in Dynamics CRM (now known as Process in Dynamics 365) allow users to create and manage automated business processes. It can be used to update entity records or related entity records. Using the OOB Workflow we can only update records which are accessible under the Workflow context. If you want to update any\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/03\/using-entity-reference-output-parameter-in-workflow-assembly\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":4780,"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,67],"tags":[457,458,1368],"class_list":["post-4776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-dynamics-crm","category-workflows","tag-custom-workflow-activity","tag-custom-workflow-activity-output-parameter","tag-process-in-dynamics-365"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4776","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=4776"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4776\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/4780"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=4776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=4776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=4776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}