Company News

How to Pass Parameters into a PowerApp

October 17, 2017

I was recently trying to replicate some functionality I’m used to with InfoPath, but this time using a PowerApp. I was looking for a way to get parameters from outside into a PowerApp, and surprisingly this is really not well documented, but actually really quite easy to do. I’ll walk you through the process below.

Note, this isn’t about passing parameters between screens in a PowerApp, that’s well covered in several blog posts, and forums.

First off, start by creating an app. Below I’ve created my “ColinTestApp” App. Next, go into the “Information” pane on the far right (highlighted by the arrow).

In there you’ll find the “Web link”. This is what you’ll use to pass variables into your app via a web URL. Note the App GUID is in in the URL – this is the unique identifier for your app.

Your Web link will look like something like this below (where the GUID of your APP replaces APP GUID).

https://web.powerapps.com/apps/[APP GUID]

To pass parameters to the App, you simply add URL parameters like this below.

https://web.powerapps.com/apps/[APP GUID]?ID=123&Ball=round&River=water

In this case, we’re passing 3 named parameters, “ID”, “Ball”, and “River” (remember, when passing URL’s over HTTP, you need to start with a question mark (?), followed by ampersands (&) for all additional parameters in a “name=value” pairing).

To use these in your PowerApp, you simply refer to them by their parameter name using the “Param” method, like below.

Param(“[PARAM NAME]”)

For example, in my case, I used it as a start variable on my initial screen. This allowed me to feed to the PowerApp a dynamic value (the ID) of the item I wanted to load at start up. In this scenario, the data was being fed from a SharePoint list, and at load time I was able to load the specific SharePoint list item I wanted into my start screen.

First(Filter(MySharePointListDataSource,ID=Param(“ID”)))

The above formula basically filters the ID parameter to the “ID” of the data source (a SharePoint list), and then from that set, I select the “first”, just for good measure (even though there should never be more than one matching ID for any given SharePoint list item).

In the above screen, just make sure you have the “DetailForm1” selected (which will allow you to set the DATA pane, and set your datasource for the form), and then be sure that 1 & 2 are the same value (i.e. if your data source (SharePoint list) is “Products”, be sure that Products is in both #1 and #2 above.

Note, I’d previously setup a DataSource that draws from my SharePoint List

So in my scenario “TestList” would be in both #1 and #2 above.

Hopefully this helps some of you out in PowerApp land!

Leave a Reply

Colin Phillips

itgroove Alumni

Colin Phillips

Subscribe via Email

Categories

Powered by...

itgroove Corporate Profile
Connect With Us