Passing Query String Parameter To PowerApps
Background
Consider a scenario where you have two PowerApps, PowerApps-1 & PowerApps-2. PowerApps-1 looks like
PowerApps-2 will look like
So the requirement is, whenever user enters the name into PowerApps-1 and click the Send button, PowerApps-2 should be opened in new tab and it should capture that name and display that in PowerApps-2.
How to pass query string in PowerApps?
We all know the syntax of Query String in web.
https://example.com/path_to_page?Key1=Value1&Key2=Value2
where,
Key: is the parameter name
Value: is the value to be passed
Similarly we can pass any value from PowerApps to another PowerApps.
To do that, you need to follow below given steps.
Design the PowerApps-2 as shown in the figure and Save it and publish it.
Next step is to get the Published app URL.
To do that we have many ways
Way-1
Click on “See all versions” button and it will open following window.
Click on Details tab and you will have following screen in front of you
Grab that link and that will be your PowerApps-2 link.
Way-2
Open the PowerApps Portal and click on Apps from the left navigation pane.
Select your PowerApps-2, then click on ellipses […], then click on Details option.
You will see a detail information about the PowerApps-2 and that will have Web link
Grab that link and that will be your PowerApps-2 link.
Now lets build our query string.
Go to the PowerApps-1 and click on Send Button and navigate to OnSelect Property.
Replace the property value with following string
Launch(“https://apps.powerapps.com/play/6c790f0f-b282-758s-b21f-85ff36f7e4ae?tenantId=5bsks2b0-xxxx-463d-xxxx-yrsysysysx?YourName=”&TextInput1.Text)
where,
YourName is parameter name
TextInput1.Text is the value that is entered into the text input.
Now go to PowerApps-2 and select App and navigate to OnStart property and add below value to it.
Set(VarYourName,Text(Param(“YourName”)))
where,
Set() is used to declare a global variable
VarYourName is the global variable name
Text() is a function that converts any value to Text. If in case you have passed Integer value like ID, and you want to receive it as Integer, then use Value() function instead of text.
Param() function is used to get the value of the query string. It accepts a string Key value. If it does not find given Key into the URL, it returns blank value.
Syntax:
Param( ParameterName )
- ParameterName – Required. The name of the parameter passed to the app.
Now go to the Text property of the label in which you want to display the received parameter.
Replace the property value with following formula
VarYourName
Save the App and Publish the app.
Now run the PowerApps-1
Enter any keyword into and click on the Send button
It will open a new tab and in that tab, PowerApps-2 will be open with your passed value
So you can see that we have successfully passed the value from One PowerApps to another using Param() function.
Similarly, we can call any PowerApps using their weblink and query string or without query string.
If you have any queries or suggestions, please feel free to reach out in the comment section.