Loading...

How To Determine If Your Canvas App Is In Studio Or Play Mode

How To Determine If Your Canvas App Is In Studio Or Play Mode

If you're a canvas app developer, you might be wondering how to differentiate between play mode and studio mode in PowerApps. While there's no out-of-the-box function to call, the good news is that there is a small work-around that can help you determine which mode you're in. In order to accomplish this, you'll need to employ the following code:

/*********************************
* Determine Studio or Play mode *
*********************************/
SaveData([true], "IsMobileApp"); // SaveData only works in the Power Apps App, not the web player
Clear(IsMobileApp);
LoadData(IsMobileApp, "IsMobileApp", true);
// TenantId is required for the web player SaveData only works in the Power Apps App,
// not the web player so if both are blank/empty then it's studio mode
Set(AppMode, If(IsBlank(Param("tenantId")) && IsEmpty(IsMobileApp), "Studio", "Play"));

Since TenantId is included in the URL for the play web page, and you cannot open the studio from the PowerApps Mobile App, the function can determine if you are in Play or Studio mode. The code enables you to automatically change how the app behaves depending on which mode it is in. This comes in handy when debugging or creating hidden sections of the app.

So if you're looking for a way to streamline your PowerApps development process, this simple trick might be just what you need!

Published on:

Learn more
.Net Dust
.Net Dust

NULL

Share post:

Related posts

Canvas Apps: App vs Screen

When building Power Apps canvas apps, it's important to understand the difference between an "app" and a "screen." An app is the entire applic...

1 year ago

Embed Canvas App into Model-Driven app Full Tutorial

If you're seeking to build customized business solutions with ease, leveraging the Dataverse platform and the power of Microsoft Power Apps is...

1 year ago

Announcing General Availability for Shared Device Mode for Power Apps on iOS

This announcement concerns the General Availability (GA) of Shared Device Mode (SDM) for Power Apps Mobile App on shared iOS devices. This fea...

8 months ago

How to check if a Power apps canvas app is running on mobile or desktop device

If you're a Power Apps canvas app developer, you might have wondered how to determine if your app is running on a mobile or desktop device. In...

10 months ago

Best Practices for Offline Mode in the Field Service mobile app – Part 2

This post is the second part of a series on the best practices for using offline mode in the Field Service Mobile app. The article focuses on ...

1 year ago

Best Practices for Offline Mode in the Field Service mobile app – Part 1 

In this 3-part blog series, you'll discover how to make the most of the Field Service mobile app's 'Offline' mode. Whether you've been using t...

1 year ago

Announcing General Availability for Shared Device Mode for Power Apps on Android

Great news for users of the Power Apps Mobile App on Android devices! The Shared Device Mode (SDM) is now available in General Availability. T...

1 year ago

Focus Mode in Viva Insights Teams App

With the release of the Viva Insights subscription, Microsoft Teams is seeing a new enhancement to its focus time experience. Users who have b...

2 years ago

Track canvas app error in Power app monitor

If you're looking to utilize Canvas Apps in Power Apps, it's crucial to know how to track and monitor any errors in your app. Canvas Apps are ...

2 years ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy