cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Pass variable from powerapps to flow

Hi,

 

I am currently working on a document library in PowerApps. I want to have a multiple selection of items and a button to trigger the flow. Unfortunately im having a hard time working to get only the item ID of the selected items from PowerApps and using it on Get Items action in MS Flow.

 

Please help.

 

powerapps.JPG

flows.JPG

 

I already used the 'Ask in PowerApps' for filter query but im having this error and not getting the item ID of the selected items on powerapps.

 

Error.JPG

 

 

 

 

 

 

 

 

 

21 REPLIES 21
Dual Super User
Dual Super User

Re: Pass variable from powerapps to flow

Try passing the ID's from PowerApps as a comma delimited list.  You can then use Split on that list in Flow to create an Array of IDs.  That should work in your Apply to Each to do a Get Item for each ID which will return the record you want to work on.  That's much more straightforward than trying to do an OData query on multiple items.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Re: Pass variable from powerapps to flow

Hi @Pstork1  ~can you give me a sample for your provided solution? I am currently new to PowerApps and im kinda lost on how to get things done.

AndrewCarter
Level 8

Re: Pass variable from powerapps to flow

I am no authority on these, but it looks like your Flow requires more than one parameter to be passed in, not just the ID.

 

Getitems_FilterQuery

Getitems_FilterQuery_1

Sendanemail_Body

 

It looks like it is complaining about one of these not being present Getitems_FilterQuery

 

Andrew

Re: Pass variable from powerapps to flow

Those parameters are created automatically by flow when you use the 'Ask in PowerApps' on Get Items filter query. On PowerApps, I am just passing the selected IDs from PowerApps to Flow which I think should be the only value in the parameter Ask In PowerApps

Dual Super User
Dual Super User

Re: Pass variable from powerapps to flow

Here's what I created as a test.  My data source is called 'Test'.  First I added a checkbox to the Gallery that displays in each record.  I added the following to the OnCheck property to add the ID of each selected record to a collection

Collect(selected,{ID:ThisItem.ID})

This goes in the OnUncheck to remove the ID from the collection if unchecked

Remove(selected,{ID:ThisItem.ID})

Then in my button to call the Flow (PowerAppsbutton-2) I used this code to build a comma delimeted string of the IDs in the selected collection

'PowerAppsbutton-2'.Run(Concat(selected,Text(ID),","))

Then in the Flow I Initialize a Variable using this formula to translate the CSV string to an Array

split(triggerBody()['Initializevariable_Value'],',')

That array then becomes the basis for my Apply to each loop to get each record and send the emails

screenshot.png

Hope that helps.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Re: Pass variable from powerapps to flow

Hi @Pstork1 - I am close to resolving this. I am already getting the values from PowerApps to Flow. However, the values that im getting is not comma delimited.

 

values.JPG

Dual Super User
Dual Super User

Re: Pass variable from powerapps to flow

Did you check to make sure all the IDs are being added to the collection when check or uncheck the boxes?  If they are then this is the code that creates the comma delimited string that you pass to flow.

'PowerAppsbutton-2'.Run(Concat(selected,Text(ID),","))

You may also be sending other parameters.  Make sure you are using the right one when it gets to Flow to build the array.  Also, you use that array in a get Item action inside a loop to get each record from SharePoint.  Then in the same loop use the values you retrieve using the Get Item to fill in the email that you want to send.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Re: Pass variable from powerapps to flow

Yes, i already check everything that you posted. I think im only passing one parameter from PowerApps to Flow using what you have posted PowerApp.Run(Concat(Selected,Text(ID),",")). Is there a way to check for other parameters that are being passed on from PowerApps to Flow?

 

On the Initialize variable, I am initializing itemids with this expression: split(triggerBody()['getitem_id'],',') How would i know what parameter to use inside that triggerbody?

Re: Pass variable from powerapps to flow

Now im getting this error on the initialize action:

 

The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Integer'

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,224)