web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Pass variable from pow...
Power Apps
Unanswered

Pass variable from powerapps to flow

(0) ShareShare
ReportReport
Posted on by 228

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

 

 

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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.

  • karl_oliverio Profile Picture
    228 on at

    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.

  • Community Power Platform Member Profile Picture
    on at

    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

  • karl_oliverio Profile Picture
    228 on at

    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

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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.

     

  • karl_oliverio Profile Picture
    228 on at

    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

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    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.

  • karl_oliverio Profile Picture
    228 on at

    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?

  • karl_oliverio Profile Picture
    228 on at

    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'

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Try creating a new Flow.   I suspect the one you have created the parameter you are passing when you original  designed it as an Integer.  I'm not sure how to delete that one or change its data type.  The value you are sending from PowerApps is clearly text.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard