top of page
Writer's pictureMatthias Schmitz

How to use a Canvas App as a redirect page

Have you ever stumbled in your projects about the need of a redirect page?


No? I have.


And I wanted to solve it with our beloved low code Power Platform. Here is how I did it:


I made use of one simple function: Launch() (and also Blank() ).


This function allows us to open web sites from our canvas apps. It opens them in a new tab. Now you need to close the old tab with the app to have a real redirect. The Exit() function does not help us here because it will move the user back to the make.powerapps.com homepage.


However, as I said, we only need one function. The Launch() function has an often unused argument: Target


Here you can find more information:

In the end, the function I put in the OnStart property of the app looks like this:


We could add some parameters to the call of google.com but in this case I left it Blank().


That's it?


Yes and no. Now we have a redirect app, that after the user opens it redirects him to Google.


But what if we want to send the user a redirect link that can dynamically change the target of the link?


For this, we need only two functions: Launch() and Param(). Okay, and also LookUp(), Blank() and GUID(). In the end, the new OnStart property looks like this:

Launch(LookUp('Important Data','Important Data' = GUID(Param("GUID"))).Hyperlink,Blank(),LaunchTarget.Replace)


I created a table called "Important Data" that had the column "Important Data" as the Unique identifier and also a column called "Hyperlink" with the content of the link the user should be redirected to.


The Param() function allows the app to access parameters of the link the user has opened the app with. In our case "GUID" is the parameter and the link the user opened the app with looks like this: https://apps.powerapps.com/play/0a363636-d421-408b-a233-1396ca6afb03?GUID=cbd4203d-722a-ef11-840a-0023485d889123


You can see the parameter "GUID" has the GUID of the record with the hyperlink.


Now you could send the user an e-mail with an embedded like similar to this and he will not see a difference to other links at first:

Sure, when the user opens the link, the canvas app will be opened and depending on the speed it will take some seconds to get it opened also to launch the hyperlink. You could add a small loading text in the middle of the app that says something like "redirect in progress".


That's it. By changing the content of the "Hyperlink" column, you can redirect the user to different web sites. For me it looks like this:



From now on, the user will be redirected to bing.com.


Hint: It might be necessary for the user do enable redirects and pop-ups for apps.powerapps.com.


Happy redirecting!


272 views0 comments

Comments


bottom of page