Passing data to Powerapp Embed and Using Parameters in PowerApps

PowerTechHub
3 min readJun 17, 2022

--

There might be scenario where you would like to display data in the Powerapp embed based on the parent page data.

Or load the PowerApp canvas app based on a predefined values(parameters).

At this point of time, the PowerApp will not be able to access the parent page context (security reasons probably :) ).

However, You will be able to pass data to the Power Embed using the PARAM function.

This means the text of the Label1 will be of the Parameter value of “USERNAME” parameter of the specific app’s Power App URL.

Similarly I had created another label which reads the “MESSAGE” parameter value of URL

Get PowerApp url. You would get it from the details of the App.

You would be having it in the below form

https://apps.powerapps.com/play/<GUID>?tenantId=<GUID>

This would be same URL which you would use for the Embed. Now, You will have to tweak a bit to pass the data down to the PowerApp.

In my example, I have “UserName” & “Message” as the parameter. My final URL would be like below.

https://apps.powerapps.com/play/<GUID>?tenantId=<GUID>?UserName=<ANYTEXT>&Message=<ANYTEXT>

Now you can use this 2 ways :

Assume a scenario, where you want to share one app with Sales team & HR Team. Both HR & Sales Team have different Landing page within the App. You could probably have a condition to check the parameter value and navigate to appropriate screens.
https://apps.powerapps.com/play/<GUID>?tenantId=<GUID>?appUser=Sales

https://apps.powerapps.com/play/<GUID>?tenantId=<GUID>?appUser=HR

You share different URLs to the HR & Sales users

Now you could use it as Embed URL as well. However, in your case you can have it dynamic — have a JS script populate the Parameter values of the App URL (as required) based on the Parent page data — like page_url,page_metadata,logged in username,some options that were selected in the parent page etc…

Have this dynamic URL as the Powerapp Embed URL’s Source.

The below is final output of my demo :

I just had simple IFRAME code to demonstrate:

--

--