{"id":110961,"date":"2018-04-12T05:55:05","date_gmt":"2018-04-12T12:55:05","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/"},"modified":"2018-04-12T05:55:05","modified_gmt":"2018-04-12T12:55:05","slug":"return-data-to-powerapps","status":"publish","type":"power-automate","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/","title":{"rendered":"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data"},"content":{"rendered":"

Return data to PowerApps from a flow<\/h2>\n

You can use Microsoft Flow to create logic that performs one or more tasks when an event occurs in a PowerApp. For example, configure a button that creates an item in a SharePoint list, sends an email or meeting request, or creates an online file. You can also use a flow to return data to PowerApps<\/em>. For example, configure a flow that retrieves data from a web endpoint, a SQL Server, or an Excel file in SharePoint, and then processes that data by using Flow’s built-in actions. You can configure any control in the app to start the flow, which continues to run even if you close PowerApps.<\/p>\n

Step One<\/h3>\n

To set up a flow that calls data from PowerApps, first start your flow with the PowerApps trigger.<\/p>\n

\"\"<\/p>\n

Next, add whatever actions you want to run when your flow is called. Inside these actions you can use the\u00a0Ask in PowerApps<\/strong>\u00a0option to collect additional parameters from the PowerApp.<\/p>\n

Step Two<\/h3>\n

After you have built your flow and collected the data you need, add the Respond to PowerApps<\/strong> action. In this action, define the output fields you want to provide to PowerApps. Name each field, and select Add Dynamic Content to pass in data from the actions in the flow.<\/p>\n

\"\"<\/p>\n

Step Three<\/h3>\n

The last step is to add your flow to the PowerApp in the formula bar. Select the control to run your flow from, and on the Action<\/strong> tab on the ribbon, select Flow<\/strong>. Select the flow you created to add it to the formula bar and pass any parameters the flow requires.<\/p>\n

\"\"<\/p>\n

We recommend that you use Set()<\/strong> or UpdateContext()<\/strong> to set a variable that stores the result of your flow. This way if you have multiple values returned from the flow, you can access different properties in various places in your app. For example, the above flow has two properties it returns,\u00a0most_sales<\/strong>\u00a0and\u00a0sellers<\/strong>, and you can use either on a control:<\/p>\n

\"\"<\/p>\n

Today, you can return basic types like Text or Email. However, there may be cases where you want to return a list of data to the PowerApp, for example a list of names. In this case, you can use the Join<\/b>\u00a0action inside of your flow, and then use the\u00a0Split<\/strong> function in your PowerApp.<\/p>\n

\"\"<\/p>\n

In the above example, you can see how the result of the flow is set in the SalesInfoVariable, and then the gallery is bound to the table output by splitting the names on a comma. If you have an array of objects <\/em>in the flow, use the\u00a0Select<\/strong>\u00a0action first, to choose the property you want to pass to the PowerApp before joining the array.<\/p>\n

Add multiple records to array inputs<\/h2>\n

There are many actions in Flow that take an array as an input. For example, the Send email<\/strong>\u00a0action has a list of Attachments\u00a0<\/strong>that can be included with the email. Before, you could either pass one attachment, or, you could generate a list of attachments from the outputs of another action using the Select<\/strong>\u00a0action. However, there was no easy way to just have two<\/em> attachments.<\/p>\n

In fact, this idea has more than 120 votes on the ideas forum<\/a> – and we’re happy to announce today that, for any action that takes a list as an input, you can add as many items inline that you wish.<\/p>\n

\"\"<\/p>\n

To add a second (or third, or fourth etc…) attachment, just click the\u00a0Add new item<\/strong>\u00a0button below the main fields for that attachment. Each time you’ll get a new set of the fields for the new attachment (or any other record you are adding). To remove an item, select the “…” menu next to the first field in the record you want to delete.<\/p>\n

Test flows with previous run data<\/h2>\n

When you are editing a flow that you have run in the past, it can be useful to be able to re-run the flow with the trigger data from a previous run. This gives you a way to verify that your flow now behaves as you expect. This has been possible before by going to the Run history<\/strong> view and selecting Resubmit<\/strong>. Now, to streamline the editing experience, we are adding a Test flow<\/strong> button directly in the designer.<\/p>\n

\"\"<\/p>\n

When you select Test flow, you will see a new pane with two options:<\/p>\n

    \n
  1. Perform the trigger action yourself.<\/strong> The action depends on what the trigger is – for example, for a button trigger you’ll run the flow button, for an email trigger you’ll send yourself an email, or for a file trigger you’ll upload a file to SharePoint online.<\/li>\n
  2. Use data from previous runs.<\/strong> Here, if your flow has run before, you’ll get a list of the most recent runs and be able to pick one to test your flow with.<\/li>\n<\/ol>\n

    \"\"<\/p>\n

    Once you run the flow you’ll immediately see the details of the flow running and be able to watch each of the steps execute. Finally, runs started via this route are marked as Tests in the run history view so you can tell them apart from flow runs that were triggered normally.<\/p>\n

    Access flow details from the workflow() expression<\/h2>\n

    The last feature we added is a new output property called tags<\/strong>\u00a0to the\u00a0workflow()<\/strong> expression. The tags contain properties like\u00a0flowDisplayName<\/strong>\u00a0and\u00a0environmentName<\/strong>. This means that – from the flow itself, you can send custom email notifications that link back to the flow. For example, this will create an HTML link back to the flow with the display name of the flow in the title:<\/p>\n

    <a href=\"https:\/\/flow.microsoft.com\/manage\/environments\/@{workflow()['tags']['environmentName']}\/flows\/@{workflow()['name']}\/details\">Open flow @{workflow()['tags']['flowDisplayName']}<\/a><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"

    Build flows that can be called from an app built with PowerApps, and return data back to the app. This means you can use the visual drag-and-drop flow designer to build the logic you need for the app. We have also added a new list builder into flow that can be used for adding multiple attachments to an email, for example. Finally, we have added a new Test flow button to the designer that lets you test your flow with trigger data from previous flow runs.<\/p>\n","protected":false},"author":347,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","power-automate-category":[2752],"power-automate-tag":[],"coauthors":[2913],"class_list":["post-110961","power-automate","type-power-automate","status-publish","hentry","power-automate-category-product-updates"],"yoast_head":"\nReturn data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog\" \/>\n<meta property=\"og:description\" content=\"Build flows that can be called from an app built with PowerApps, and return data back to the app. This means you can use the visual drag-and-drop flow designer to build the logic you need for the app. We have also added a new list builder into flow that can be used for adding multiple attachments to an email, for example. Finally, we have added a new Test flow button to the designer that lets you test your flow with trigger data from previous flow runs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Power Platform Blog\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 min read\" \/>\n\t<meta name=\"twitter:label2\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data2\" content=\"Stephen Siciliano\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/\",\"name\":\"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.png\",\"datePublished\":\"2018-04-12T12:55:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.webp\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.webp\",\"width\":942,\"height\":507,\"caption\":\"graphical user interface, application, Word, Teams\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Power Automate\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"name\":\"Microsoft Power Platform Blog\",\"description\":\"Innovate with Business Apps\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\",\"name\":\"Microsoft Power Platform Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"width\":194,\"height\":145,\"caption\":\"Microsoft Power Platform Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/","og_locale":"en_US","og_type":"article","og_title":"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog","og_description":"Build flows that can be called from an app built with PowerApps, and return data back to the app. This means you can use the visual drag-and-drop flow designer to build the logic you need for the app. We have also added a new list builder into flow that can be used for adding multiple attachments to an email, for example. Finally, we have added a new Test flow button to the designer that lets you test your flow with trigger data from previous flow runs.","og_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/","og_site_name":"Microsoft Power Platform Blog","og_image":[{"url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 min read","Written by":"Stephen Siciliano"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/","name":"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data - Microsoft Power Platform Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.png","datePublished":"2018-04-12T12:55:05+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#primaryimage","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.webp","contentUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2024\/06\/return-data-to-powerapps-trigger.webp","width":942,"height":507,"caption":"graphical user interface, application, Word, Teams"},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/return-data-to-powerapps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/"},{"@type":"ListItem","position":2,"name":"Power Automate","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/"},{"@type":"ListItem","position":3,"name":"Return data to PowerApps from a flow, build lists in a flow, and test a flow with previous run data"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","name":"Microsoft Power Platform Blog","description":"Innovate with Business Apps","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization","name":"Microsoft Power Platform Blog","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","width":194,"height":145,"caption":"Microsoft Power Platform Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/"}}]}},"msxcm_display_generated_audio":false,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Power Platform Blog","distributor_original_site_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate\/110961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/types\/power-automate"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/users\/347"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/comments?post=110961"}],"version-history":[{"count":0,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate\/110961\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/media?parent=110961"}],"wp:term":[{"taxonomy":"power-automate-category","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate-category?post=110961"},{"taxonomy":"power-automate-tag","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate-tag?post=110961"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/coauthors?post=110961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}