Retrieving parameters from a URL in Power Apps

Share the love

Sometimes we need parameters from external sources to be passed into our applications. Thankfully, this is easy to do in Power Apps.

In my post today, I show you how to pass in parameters using a URL. When a user opens the Power App in their browser, the parameters in the URL will be passed into the application.

To create the parameters for the URL, I created a flow in Power Automate to create a dynamic URL (you don’t have to do this step, but my URL was based on a date range and team name so I used the flow to calculate this). The last action in my flow was to send an email to the list of recipients that I needed to open the Power App and fill out my form. The URL that was constructed took the following form (ParameterNames replaced with your actual parameter names, i.e. Dates or Team etc.). You can pass multiple parameters in the URL by separating parameters using (&) ampersand.

https://apps.powerapps.com/play/<AppID>?tenantId=<TenantID>?ParameterName1=<Parameter1>&ParameterName2=<Parameter2>

Now we have the URL, your app will open up fine with these parameters in the URL, but it can’t read the parameters unless you specifically tell Power Apps to do so.

Edit your Power App, select the OnVisible property on the first screen of your application. We will set the parameters from the URL in this property.

Create a new variable in your Power App (in the example below, I create two new variables called varVariable1 and varVariable2). Set these variables to the name of the parameters you set in the URL (for example, if you said Dates=4/4/2020, your parameter name is Dates). In my example, my parameters were ParameterName1 and ParameterName2.

Set(
    varVariable1,
    Param("ParameterName1")
);
Set(
    varVariable2,
    Param("ParameterName2")
);

Now we have retrieved the parameters, it’s time to use it in our Power App. This can be used like any other variable in your Power App (you can use it to look up other information in another data source for example). However, for this post, I’ll show you how to insert the parameter into a text field as a default value. Insert a text input into your app and put your variable in the Default field. If you don’t want the field to be editable, choose the DisplayMode property and write DisplayMode.View.


Share the love

One Reply to “Retrieving parameters from a URL in Power Apps”

Leave a Reply

Your email address will not be published.