cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

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
Highlighted
Dual Super User II
Dual Super User II

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.
Highlighted
Resolver I
Resolver I

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.

Highlighted
Resolver II
Resolver II

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

Highlighted
Resolver I
Resolver I

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

Highlighted
Dual Super User II
Dual Super User II

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.
Highlighted
Resolver I
Resolver I

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

Highlighted
Dual Super User II
Dual Super User II

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.
Highlighted
Resolver I
Resolver I

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?

Highlighted
Resolver I
Resolver I

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,828)