💡 Challenge

While developing apps in Power Apps Studio mode, we often use test values like a test email address. However, it’s easy to forget to remove these values before deploying the app to production.

✅ Solution

Detect when the app is in Studio Mode and use a test email for development, switching to the user’s actual email in production.

🔧 How It’s Done

Here’s how to do it:

  1. Define the Studio Mode variable
    🔸 fxIsStudioMode = StartsWith(Host.Version, “PowerApps-Studio”)
    🔸 Checks if the app is running in Power Apps Studio.
  2. Define the user email variable
    🔸 fxUserEmail = If(fxIsStudioMode, “testaccount@company.com”, User().Email)
    🔸 Uses the test account in Studio Mode and the user’s email in production.

🎉 Result

Automatically uses test email during development and correct user email in production, eliminating manual changes and reducing deployment errors.

🌟 Key Advantages

🔸 Prevents accidental deployment of test data
🔸 Saves time by automating email assignment
🔸 Enhances app security and consistency


🎥 Video Tutorial


🛠️ FAQ

1. How do I determine if my app is in Studio Mode?
Use the StartsWith function on Host.Version to check for “PowerApps-Studio”.

2. Can I apply this pattern to other test values?
Yes, you can use similar logic to switch between development and production values for any parameter.

3. Where should I place these formulas in my app?
Include them in the App.OnStart property so that the variables are set when the app initializes.

Marcel Lehmann

Marcel Lehmann

Microsoft MVP Microsoft MVP

BizzApps MVP from Switzerland 🇨🇭 - PowerPlatform Expert & Evangelist & MVP - Turning passion into expertise

MVP since 2023 Power Platform Expert since 2017

Leave a comment