(Part 6) How to build a Canvas Power App – Deep linking

door | 06-10-22 | Learning Lessons | 0 Reacties

Oops, a little later this week than planned but as promised a blog about the OnStart, StartScreen, and deep linking in Power Apps. And a blog with this kind of functionality can never be too late. So let’s start.

In the previous blog, we accessed different items through the app itself. But what if we want to access the items through an external source, can we do that, and how should that work? Stay tuned and I’ll show you the ins and out’s of deep linking.

For this example, we use the SharePoint list we created in the first blog. What we want to do is to access an item in the app by clicking a link in this SharePoint list. The first step is to get the link to your app by going to:  https://make.powerapps.com/Apps and clicking the three horizontal dots next to your Power App.

Now copy the link that is visible under ‘Web link’. Paste the link in your address bar and the app will load in your browser. The next thing we are going to try is to add the link as a hyperlink to the list. Go to the list, click on ‘Add column’ and add a hyperlink field. When you edit an item, you can edit this hyperlink column you just added. Paste the weblink you just copied into this field and press save. You’ll notice one link that will take you to the first screen of the Power App when you click on it.

But that is not what we want and not ideal, this means that you need to add a link to every item and it won’t link you to the right item in the app. To obtain this we’re going to change the format of the other column, by clicking on the column where a deep link directly to the item needs to appear, and clicking on ‘Format this Column. I use the GivenName column. On the appearing screen, you can click on ‘advanced mode’. In this window, we can enter a JSON to change the layout of this column. In my example I entered the following JSON:

Now all GivenName entries contain a link to the Power App. When you click on it, the link will take you to the first screen in the app. Awesome right? But like I said before, we can take this a step further. We can go directly to the item we click on in the SharePoint list. To do that we’re going to modify the weblink to the Power App. Behind the link, we’re going to define the StartScreen and the ItemID of the item we clicked on. My link looks like this:

All of the properties in the GivenName properties are now clickable hyperlinks. When you click one of the you’ll be taken to the app, and at the end of your URL, you can notice the parameters we just defined. When the app is opened through the link we need to make sure that three things happen.

  1. The ItemID parameter needs to be set into a variable.
  2. In the OnVisible property of the scrn_Item screen, we need to update the context of the objSelectedItem with the item we clicked on.
  3. Open the correct screen.

To accomplish the first step you go to the OnStart property and set the param to a variable with the following formula:

Param(): A function that takes the defined parameter from the address bar.
Value(): Makes a numeric value from a text value.

Sidenote: The Value() function is needed because the ID is a numeric field and a Param is a text value. This way we convert the parameter to a numeric value and don’t get warnings such as delegation.

To accomplish this, the second point goes to the OnVisible property in the scrn_Item screen and updates the context of objSelectedItem with a lookup function with the parameter variable as a parameter in the formula. You can do this with the following formula:

Last but not least, go to the right screen, the landing screen. Go to the StartScreen property and add the following formula:

If you want you can change the back() function to a navigate function in the back icon. This way the app is also operational from the SharePoint link.

Don’t forget to publish your app and try the new functionality from your SharePoint list.

Part 7 – SharePoint button layout –>

<– Part 5 – Design the layout of this canvas app
<– Introduction – Index

Ramon Maanders

Ramon Maanders

Power Platform Consultant @ ModiShare

Always looking for opportunities to automate, simplify and optimize processes and IT through the Microsoft Power Platform. Ramon writes blogs on a recurring basis about insights and the possibilities about the Microsoft Power Platform.

(Dutch) Altijd op zoek is naar mogelijkheden om processen en IT te automatiseren, te versimpelen en te optimaliseren door middel van het Microsoft Power Platform. Ramon schijft op terugkerende basis blogs over inzichten en de mogelijkheden omtrent het Microsoft Power Platform.

0 reacties

Een reactie versturen

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site wordt beschermd door reCAPTCHA en Google Privacy Policy en Servicevoorwaarden toepassen.

Microsoft 365 nieuws en updates maandelijks in je inbox?

Met onze Monthly Recap mail ontvang je elke maand onze updates in jouw mailbox.

Per maand

Microsoft 365 nieuws en updates maandelijks in je inbox?

Met onze Monthly Recap mail ontvang je elke maand onze updates in jouw mailbox.