The target in the Launch function in Power Apps Microsoft Power Apps

The target in the Launch function in Power Apps

The Launch function in Power Apps helps you to open links in your browser from your app.

Launch Function

The launch function has had a few additional options added recently, and even though they are apparently still in preview they are worth it to have a look at.

Open a site using Launch

The simplest example is shown below.

Launch("SharePains.com")
The target in the Launch function in Power Apps Microsoft Power Apps

When you click on the button the site will be opened. Notice that you don’t have to supply the https part of the url although you could do so.

Use query parameters in Launch

There are 3 options to add query parameters. Any of the below options will work.

Launch("Google.com/search?q=SharePains.com")
Launch("Google.com/search","q","SharePains.com")
Launch("Google.com/search",{q:"SharePains.com"})
The target in the Launch function in Power Apps Microsoft Power Apps

The 3rd options however is the best option to use as we will see shortly.

Set the LaunchTarget

There is now an additional parameter available if you use the json format to supply the parameters.

The first option is New, which will open the link in a new tab.

The target in the Launch function in Power Apps Microsoft Power Apps

The other option is Replace, which will replace the content in your current window.

The target in the Launch function in Power Apps Microsoft Power Apps

Note that this only works when you are in the player. In development mode even though you specify replace the url will still be opened in a new tab. I’m actually quite glad that this is the case as I would permanently forget to save my work first.

Also an important thing to note is that the target above is actually set to _self.

You can also simply set the target to a text value instead of using the New or Replace as shown above. More on this can be found at the target documentation.

Calling apps from Power Apps using Launch

Now you could create an app that calls other apps. as shown below.

Launch("https://apps.powerapps.com/play/18295fb3-4723-4388-80d2-09ca5217a2f8",{tenantId:"..."}, Replace)
Use the Launch function to open a new app in the same tab

This works really quite well, the only thing that I noticed is that once again this only works in play mode and when you are testing this in development mode a new tab is opened.

Additionally when you use the Launch function in Development mode, the app is opened in Development mode as well, rather than in play mode.

So with this new feature it is now possible to have multiple apps launching in the same tab making them almost feel like one app.-

3 thoughts on “The target in the Launch function in Power Apps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Archive