{"id":23516,"date":"2020-05-13T12:52:24","date_gmt":"2020-05-13T12:52:24","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=23516"},"modified":"2022-06-14T14:38:02","modified_gmt":"2022-06-14T09:08:02","slug":"how-to-pass-power-apps-collection-in-power-automate-using-json-function","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2020\/05\/how-to-pass-power-apps-collection-in-power-automate-using-json-function\/","title":{"rendered":"How to pass Power Apps Collection in Power Automate using Json Function"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p style=\"text-align: justify;\">Earlier, we have seen how to pass parameter from Power Apps to Power Automate. In today\u2019s blog, we will explore how to pass the Collection from Power Apps (Canvas App) to Power Automate. A collection in Power Apps is used to store data. You can explore more about Collection in Power Apps <a href=\"https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/canvas-apps\/functions\/function-clear-collect-clearcollect\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. \u00a0Now, consider that you want to update a large amount of records using Patch and ForAll functions in background asynchronously, so user has no need to wait for completion of request. To process this we need to create Power Automate where a collection from Power Apps will be passed and the flow will process the collection and do the operation as per our requirement since if we use Patch and ForAll functions and user exits the app the operation may stop. Below we have shown an example to pass the collection from Power Apps to Power Automate.<\/p>\n<p>Now let\u2019s consider a scenario where Manager wants to send a mail to other users in system to follow up the task.<\/p>\n<p><strong>1<\/strong>. We created a sample user app and design as shown in below screenshot:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23517\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/1Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"864\" height=\"532\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/1Power-Automate-using-Json-Function.png 864w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/1Power-Automate-using-Json-Function-300x185.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/1Power-Automate-using-Json-Function-768x473.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/1Power-Automate-using-Json-Function-660x406.png 660w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/p>\n<p><strong>2<\/strong>. Now on &#8216;onCheck&#8217; property of the Checkbox lets create a user collection with below formula:<\/p>\n<p><strong>Collect(UserColle,{userEmail:ThisItem.&#8217;Primary Email&#8217;,fullName:ThisItem.&#8217;Full Name&#8217;,userId:ThisItem.User})<\/strong><\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-23518\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1251\" height=\"462\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function.png 1251w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function-300x111.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function-768x284.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function-1024x378.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/2Power-Automate-using-Json-Function-660x244.png 660w\" sizes=\"(max-width: 1251px) 100vw, 1251px\" \/><\/a><\/p>\n<p><strong>3<\/strong>. Now on &#8216;onUnCheck&#8217; property of the Checkbox lets remove the user from user collection with below formula:<\/p>\n<p><strong>If(LookUp(UserColle,userId=ThisItem.User, true ),Remove(UserColle,First(Filter(UserColle,userId=ThisItem.User))))<\/strong><\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-23519\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1306\" height=\"435\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function.png 1306w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function-300x100.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function-768x256.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function-1024x341.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/3Power-Automate-using-Json-Function-660x220.png 660w\" sizes=\"(max-width: 1306px) 100vw, 1306px\" \/><\/a><\/p>\n<p><strong>4<\/strong>. Now let\u2019s create a Power Automate which run on click of <img decoding=\"async\" class=\" wp-image-23523 alignnone\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/7Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"20\" height=\"14\" \/> icon and sends email to the selected users in the app. Login to <a href=\"https:\/\/flow.microsoft.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/flow.microsoft.com<\/a><a href=\"https:\/\/flow.microsoft.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">\/<\/a> and create a new flow using the &#8216;Power App Button&#8217; Template as shown in below screenshot:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23520\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1200\" height=\"424\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function.png 1200w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function-300x106.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function-768x271.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function-1024x362.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/4Power-Automate-using-Json-Function-660x233.png 660w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p><strong>5<\/strong>. Now add an action as &#8216;Parse Json&#8217; and add content &#8216;Ask in PowerApps&#8217; as shown in below screenshot:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23521\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function.png\" alt=\"5. Now add an action as \u201cParse Json\u201d and add content as \u201cAsk in PowerApps\u201d as shown in below screenshot:\" width=\"1222\" height=\"544\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function.png 1222w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function-300x134.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function-768x342.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function-1024x456.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/5Power-Automate-using-Json-Function-660x294.png 660w\" sizes=\"(max-width: 1222px) 100vw, 1222px\" \/><\/p>\n<p><strong>6<\/strong>. Now add \u2018Apply to each loop\u2019 to send email for the each selected user as shown in below screenshot:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23522\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1046\" height=\"709\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function.png 1046w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function-300x203.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function-768x521.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function-1024x694.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/6Power-Automate-using-Json-Function-660x447.png 660w\" sizes=\"(max-width: 1046px) 100vw, 1046px\" \/><\/p>\n<p><strong>7<\/strong>. Now back in the Power Apps on &#8216;On Select&#8217; property of the\u00a0 <img decoding=\"async\" class=\"wp-image-23523 alignnone\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/7Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"20\" height=\"14\" \/> icon add the MS flow by selecting Action -&gt; Power Automate -&gt;&#8217;MS flow&#8217;:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23524\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1083\" height=\"485\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function.png 1083w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function-300x134.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function-768x344.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function-1024x459.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/8Power-Automate-using-Json-Function-660x296.png 660w\" sizes=\"(max-width: 1083px) 100vw, 1083px\" \/><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23525\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"1027\" height=\"448\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function.png 1027w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function-300x131.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function-768x335.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function-1024x447.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/9Power-Automate-using-Json-Function-660x288.png 660w\" sizes=\"(max-width: 1027px) 100vw, 1027px\" \/><\/p>\n<p><strong>8<\/strong>. As soon as the Power Automate is added on the &#8216;On Select&#8217; property pass the User collection in JSON format as shown below:<\/p>\n<p><strong>SendEmail.Run(JSON(UserColle,JSONFormat.Compact))<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-23526\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/10Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"868\" height=\"311\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/10Power-Automate-using-Json-Function.png 868w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/10Power-Automate-using-Json-Function-300x107.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/10Power-Automate-using-Json-Function-768x275.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/10Power-Automate-using-Json-Function-660x236.png 660w\" sizes=\"(max-width: 868px) 100vw, 868px\" \/><\/p>\n<p><strong>9<\/strong>. Now run the app, select users, click on icon and see the collection is passed to Power Automate.<\/p>\n<p style=\"padding-left: 80px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-23527\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/11Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"366\" height=\"619\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/11Power-Automate-using-Json-Function.png 366w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/11Power-Automate-using-Json-Function-177x300.png 177w\" sizes=\"(max-width: 366px) 100vw, 366px\" \/><\/p>\n<p><strong>10<\/strong>. Now as shown in below screenshot the flow has run successfully and the entire collection is passed in flow.<\/p>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-23528\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/12Power-Automate-using-Json-Function.png\" alt=\"Power Automate using Json Function\" width=\"532\" height=\"497\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/12Power-Automate-using-Json-Function.png 532w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2020\/05\/12Power-Automate-using-Json-Function-300x280.png 300w\" sizes=\"(max-width: 532px) 100vw, 532px\" \/><\/p>\n<p>You can refer more on JSON function in Power Apps <a href=\"https:\/\/docs.microsoft.com\/en-us\/powerapps\/maker\/canvas-apps\/functions\/function-json\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>Thus, as illustrated above you can now easily pass the entire Power Apps collection in Power Automate by using JSON function.<\/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.<\/strong><\/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 Earlier, we have seen how to pass parameter from Power Apps to Power Automate. In today\u2019s blog, we will explore how to pass the Collection from Power Apps (Canvas App) to Power Automate. A collection in Power Apps is used to store data. You can explore more about Collection in Power Apps here. \u00a0Now,\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2020\/05\/how-to-pass-power-apps-collection-in-power-automate-using-json-function\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":23537,"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":[44,1985],"tags":[],"class_list":["post-23516","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-power-apps","category-power-automate"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/23516","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=23516"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/23516\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/23537"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=23516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=23516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=23516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}