{"id":21406,"date":"2019-12-16T12:37:53","date_gmt":"2019-12-16T12:37:53","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=21406"},"modified":"2021-08-25T10:58:15","modified_gmt":"2021-08-25T10:58:15","slug":"interacting-with-power-automate-flows","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/12\/interacting-with-power-automate-flows\/","title":{"rendered":"Interacting with Power Automate Flows from Power Apps &#8211; Canvas Apps"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p>It is well-known that Power Automate is a low-code, no-code solution to automation with various triggers that it supports including Event driven, HTTP request, Timer\/Scheduled and Manual flows.<\/p>\n<p style=\"text-align: justify;\">Manual\/Button flows help in designing powerful Canvas Apps that can offload complex logic executions to flow while focusing on user experience of the app. In this article we will discuss an example to call a flow and pass user inputs received in Canvas Apps to the flow \u2013 have the logic execute there and return resulting value to the <a href=\"https:\/\/www.inogic.com\/blog\/2021\/01\/how-to-build-responsive-canvas-apps\/\" target=\"_blank\" rel=\"noopener noreferrer\">Canvas Apps<\/a> for display.<\/p>\n<p style=\"text-align: justify;\">In this example, we have a canvas app that accepts requested meeting time, the app then calls the flow to check availability for the said time, if the time slot is unavailable, it will return false to app to notify the user accordingly.<\/p>\n<p>I have shared the key settings to achieve this by using Case entity from Dynamics 365 CRM. A quick design of the entry form is given below:<\/p>\n<p style=\"padding-left: 160px;\"><img decoding=\"async\" class=\"aligncenter wp-image-21418\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"356\" height=\"535\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows.png 824w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows-200x300.png 200w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows-768x1154.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows-682x1024.png 682w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/1Interacting-with-Power-Automate-Flows-660x992.png 660w\" sizes=\"(max-width: 356px) 100vw, 356px\" \/><\/p>\n<p>Note the customer field when placed on form does not show up the field on Canvas for data entry. Lookup fields are not currently supported. Here is how I got this to work:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21417\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"1258\" height=\"1004\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows.png 1258w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows-300x239.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows-768x613.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows-1024x817.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/2Interacting-with-Power-Automate-Flows-660x527.png 660w\" sizes=\"(max-width: 1258px) 100vw, 1258px\" \/><\/p>\n<p>Select the Data card created for Customer when you include that field on the form from tree view and then choose Insert Drop Down.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21416\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"1258\" height=\"938\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows.png 1258w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows-300x224.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows-768x573.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows-1024x764.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/3Interacting-with-Power-Automate-Flows-660x492.png 660w\" sizes=\"(max-width: 1258px) 100vw, 1258px\" \/><\/p>\n<p>Set the properties of the drop-down as shown below:<\/p>\n<p>Items = Sort(Accounts,&#8217;Account Name&#8217;) \u2013 This will show the list of accounts sorted by name.<\/p>\n<p>With the Customer_DataCard3 still selected in the tree view add a Label and set the name to \u2018Customer\u2019.<\/p>\n<p>With this done, we now get the drop down of accounts listed. However, the value selected in the drop-down will not be submitted as the value for Customer Card and therefore will not be saved in database when we submit the form.<\/p>\n<p>To be able to edit the property to the Card, we need to first Unlock it by clicking on lock icon.<\/p>\n<p style=\"padding-left: 80px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-21415\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/4Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"644\" height=\"192\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/4Interacting-with-Power-Automate-Flows.png 644w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/4Interacting-with-Power-Automate-Flows-300x89.png 300w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/p>\n<p>Next, we edit the <strong>Update<\/strong> property of card to set the value as <strong>Dropdown1.Selected<\/strong> as shown below:<\/p>\n<p style=\"padding-left: 120px;\"><img decoding=\"async\" class=\"aligncenter wp-image-21414\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/5Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"446\" height=\"742\" \/><\/p>\n<p>With this done, any change in the value of dropdown will bind the selected value to the customer property.<\/p>\n<p>Next let\u2019s work on designing the Power Automate Flow that need to call to check availability.<\/p>\n<p>For this, choose the OnSelect property of Request button and choose Action \u00e0 Power Automate to bring up the following screen.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21413\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"1698\" height=\"980\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows.png 1698w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows-300x173.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows-768x443.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows-1024x591.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/6Interacting-with-Power-Automate-Flows-660x381.png 660w\" sizes=\"(max-width: 1698px) 100vw, 1698px\" \/><\/p>\n<p>As we do not have our flow already designed, we choose \u2018Create a new flow\u2019 which navigates us to the flow designer.<\/p>\n<p>Type PowerApps in the connector search bar and select the PowerApps trigger.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21412\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"2370\" height=\"1246\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows.png 2370w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows-300x158.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows-768x404.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows-1024x538.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/7Interacting-with-Power-Automate-Flows-660x347.png 660w\" sizes=\"(max-width: 2370px) 100vw, 2370px\" \/><\/p>\n<p>This would be the trigger to be used to invoke the flow from Canvas Apps. Do note that only flows that are based on PowerApps trigger would show up in the Power Automate action list for selection.<\/p>\n<p>Here is a screenshot of a very simple flow designed for this blog.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21411\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"2370\" height=\"1246\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows.png 2370w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows-300x158.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows-768x404.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows-1024x538.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/9Interacting-with-Power-Automate-Flows-660x347.png 660w\" sizes=\"(max-width: 2370px) 100vw, 2370px\" \/><\/p>\n<p>In order to generate a parameter for the flow, choose the \u2018Ask in PowerApps\u2019 option from Dynamic content. This will auto generate a parameter for you for the base time field as shown below.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21410\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"2370\" height=\"1164\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows.png 2370w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows-300x147.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows-768x377.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows-1024x503.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/10Interacting-with-Power-Automate-Flows-660x324.png 660w\" sizes=\"(max-width: 2370px) 100vw, 2370px\" \/><\/p>\n<p>In order to return a value back to the calling App use the action \u2018Respond to a PowerApp or flow\u2019.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21409\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"1242\" height=\"800\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows.png 1242w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows-300x193.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows-768x495.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows-1024x660.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/11Interacting-with-Power-Automate-Flows-660x425.png 660w\" sizes=\"(max-width: 1242px) 100vw, 1242px\" \/><\/p>\n<p>Now set the value you need to return. Define the data type that you want to return by clicking on \u2018Add an output\u2019.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-21408\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows.png\" alt=\"Interacting with Power Automate Flows\" width=\"1242\" height=\"464\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows.png 1242w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows-300x112.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows-768x287.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows-1024x383.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/12Interacting-with-Power-Automate-Flows-660x247.png 660w\" sizes=\"(max-width: 1242px) 100vw, 1242px\" \/><\/p>\n<p>Note that you could return more than one value back to the calling App. It is received in the calling app in the form of a record with each output parameter name as a field in that record.<\/p>\n<p>Save the flow and now let\u2019s move back to the canvas app to call this in our app.<\/p>\n<p style=\"padding-left: 120px;\"><img decoding=\"async\" class=\"aligncenter wp-image-21407\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/13Interacting-with-Power-Automate-Flows.png\" alt=\"3Interacting with Power Automate Flows\" width=\"401\" height=\"596\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/13Interacting-with-Power-Automate-Flows.png 644w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/12\/13Interacting-with-Power-Automate-Flows-202x300.png 202w\" sizes=\"(max-width: 401px) 100vw, 401px\" \/><\/p>\n<p>On the Request button in canvas app, we pass the date value selected in the First Response By field and send it to the flow as a parameter for evaluating availability. The flow returns a Boolean value based on its evaluation.<\/p>\n<p>Set the following on the OnSelect property of Request button.<\/p>\n<p><em>Set(Available, &#8216;PowerApp-&gt;Performanunboundaction,RespondtoaPowerApporflow&#8217;.Run(&#8216;First Response By_DataCard1&#8217;.Update));If(Available.result,SubmitForm(Form1);NewForm(Form1), Notify(&#8220;Invalid date entered&#8221;));<\/em><\/p>\n<p>Using Set() function we are storing the return value from the Flow to the variable named Available.<\/p>\n<p>&#8216;PowerApp-&gt;Performanunboundaction,RespondtoaPowerApporflow&#8217;.Run(&#8216;First Response By_DataCard1&#8217;.Update))<\/p>\n<p>In the above statement, we make a call to the Power Automate Flow and pass the value of the First Response By field.<\/p>\n<p>Notice, we access the output parameter returned from flow as<\/p>\n<p>Available.result \u2013 where result is name of the output parameter defined.<\/p>\n<p>This now completes the canvas app, and you are ready to test it by entering values in the app.<\/p>\n<p><em><strong>Notes:<\/strong><\/em><\/p>\n<ol>\n<li><em><strong>Begin designing the canvas app and flow from within the context of a solution<\/strong><\/em><\/li>\n<li><em><strong>Work with the Common Data Service (Current) connector.<\/strong><\/em><\/li>\n<li><em><strong>When Perform Unbound Action action is added, we are unable to invoke the flow from the Canvas Apps, <a href=\"https:\/\/www.inogic.com\/blog\/2019\/12\/child-flows-to-the-rescue\/\" target=\"_blank\" rel=\"noopener noreferrer\">this problem could be solved using Child Flows<\/a>!!<\/strong><\/em><\/li>\n<\/ol>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>In this way, we would be able to design a Canvas App (no-code) and have the business logic execute written as a Custom Action (pro-dev) by using a (no-code\/low-code) Flow &#8211; The no-cliff solution to building powerful apps.<\/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\">Free 70% of storage space in CRM with Attachment Management Apps!<\/div><\/div><\/h2>\n<p><em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/attach-2-dynamics-365-crm-upload-multiple-files-sharepoint-cloud-storage\" target=\"_blank\" rel=\"noopener noreferrer\">Attach2Dynamics<\/a> &#8211; Store and manage documents\/attachments in cloud storage of your choice &#8211; SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.<\/em><br \/>\n<em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/dynamics-365-crm-sharepoint-security-metadata-sync\" target=\"_blank\" rel=\"noopener noreferrer\">SharePoint Security Sync<\/a><\/strong> \u2013 Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction It is well-known that Power Automate is a low-code, no-code solution to automation with various triggers that it supports including Event driven, HTTP request, Timer\/Scheduled and Manual flows. Manual\/Button flows help in designing powerful Canvas Apps that can offload complex logic executions to flow while focusing on user experience of the app. In this\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/12\/interacting-with-power-automate-flows\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":21421,"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":[1954,16,19,36,1913,44,1985],"tags":[1986,1975],"class_list":["post-21406","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-canvas-apps","category-dynamics-365","category-dynamics-crm","category-microsoft-flow","category-microsoft-power-platform-services","category-power-apps","category-power-automate","tag-microsoft-flows","tag-power-automate"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/21406","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=21406"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/21406\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/21421"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=21406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=21406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=21406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}