To pass parameter in App URL, you need to find App URL first as below:
- Login to PowerApp web portal. Click on your app under Apps.
- Scroll to bottom of page under Details tab to find Web Link. Make a note of App ID in case you want to embed your App to Power BI, SharePoint, Dynamics 365 etc.
- Copy your Web Link which will be in format https://web.powerapps.com/apps/%5BAPP GUID] where App GUID would be GUID value of your app
Pass Parameter in PowerApp URL:
Passing parameters to App URL is as simple as passing parameters to any HTTP URL using (?) question mark. You can pass multiple attributes in App URL by separating parameters using (&) ampersand.
I have Company Detail screen which displays company name, phone, logo and related products. In case, you want to pass company name as parameter in App URL, update your App Web Link to include company name parameter as below:
Consume Parameter in PowerApp:
In Company Detail screen, I have Detail Form which displays company details based on selected company from gallery in Browse screen. Also, I have list of products shown for selected company. To display company details and related products based on “CompanyName” parameter we need to update Items property of Detail Form and Products Gallery as below.
- To consume parameters passed in App URL, use Param function as Param(“parametername”). In my case it would be Param(“CompanyName”)
- Select DetailForm, update Items property as below to select company based on parameter “CompanyName”. Here Coalesce method is used which returns first not-null value from values passed. If CompanyName parameter is not passed in URL and contains null value, then Coalesce function will return “Microsoft” as default value.
LookUp(Companies,cr2a5_companyname = Coalesce( Param(“CompanyName”) ,”Microsoft”))
- Similarly update Items property of ProductsGallery to filter and display products for Company with name passed as parameter.
Filter(‘Company Products’, cr2a5_Company1.cr2a5_companyname=Coalesce(Param(“CompanyName”),”Microsoft”))
- Save and publish your app. Make sure Company Detail form is first form in your application. If not move Company Detail form to the top and then Save & Publish.
- Pass different company names as parameter in App URL and your app will display company details accordingly as below
In my next blog, we will see how to embed PowerApp in Dynamics 365 entity form as web resource and pass RecordID as parameter to open PowerApp in context of entity record.