Return Arrays from Power Automate to Power Apps without a premium licence Microsoft Power Automate image 10

When you want to return arrays from a flow in Power Automate to an app in Power Apps you could use the Response action, however this requires a premium connector

Return Arrays from Power Automate to Power Apps without a premium licence Microsoft Power Automate image 6

Avoiding the premium licences

First of all if your flow really uses premium features then just get that premium licence in place, but if you don’t use any other premium features then you might want to use the method described in this post to avoid the costs of a premium licence.

In my case my client wanted to display documents in a a document library and enable the management of document versions inside an app.

Building the flow

So I started by creating a flow that asks for the ID of a document and then all the versions are returned by the REST API call following.

Return Arrays from Power Automate to Power Apps without a premium licence Microsoft Power Automate image 8

The above returns potentially a lot of data that we want to send to the app.

The data that we get returned will need to be reshaped using the apply to each with a compose action side. Simply create a list of fields returned by the Apply to each and separate them by something that you would never find in the data. I’m using ### in this case.

Return Arrays from Power Automate to Power Apps without a premium licence Microsoft Power Automate image 9

Now we just need to return this to the app:

Return Arrays from Power Automate to Power Apps without a premium licence
In the Respond to a Power App action we use the following expression
join(outputs('Compose'),'##Version##')

This will now give us an array of data where each item is separated by ##Version## and each field is separated by ###

Using the data in the app

Now within the app we can create a gallery that has the following items code:

colVersionHistory

And use some code to set this collection using the following one liner

ClearCollect(colVersionHistory, Split(Getversionsofdocuments.Run(ThisItem.ID).result,”##Version##”).Result);

Then for each field we want to display inside the gallery

Index(Split(ThisItem.Result,"###").Result,1).Result

The above will get the first field. To get the second field simply replace the 1 with a 2 and so on.

And that is it. An easy way to send arrays of data back to your app.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

3 thoughts on “Return Arrays from Power Automate to Power Apps without a premium licence”
  1. Hey Pieter,

    Thank you for sharing this, what is your thoughts on using the methood as in this youtube video?

    https://www.youtube.com/watch?v=cUKtQslS68E

    The reason why I am asking because you have a for each loop, and if you were to grab say some 300 items, that loop would be running 300 times, and depending on how big the list it, it could eat up a fair bit of API requests.

    Cheers

    1. Hi Daniel,

      That roughly uses the same idea. I’m only displaying the array in a gallery where in that recording the data is being processed in a ForAll . ForAll processing is in general quite slow. So I’m not sure if I would use the ForAll, but the idea of passing arrays between flows and apps is the same.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading