web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using Environment Vari...
Power Apps
Unanswered

Using Environment Variables in Canvas Apps

(1) ShareShare
ReportReport
Posted on by 195

I created an Environment Variable ('envType') in a solution. It has a data type of 'Text' and I would like to reference the variable in my canvas app.  Is this possible?  If so, how?

 

The purpose of the variable is to be able to tell if I'm in my Dev environment or my Production environment.

 

If it's not possible to reference 'envType' in a canvas app, how can I tell if I'm in Dev vs. Production?

 

Thanks for any help or insight.

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    There are two possible ways to do this.

    1) If you have a Premium license, you can read the value directly from the Dataverse table where its stored using code like this

    LookUp('Environment Variable Values', 'Environment Variable Definition'.'Schema Name' = "EnvironmentVariableName").Value

    2) If you don't have a Premium license you can call a Flow to read and return the environment variable value. Environment variables are available as dynamic content in Power Automate.

  • isogunro1 Profile Picture
    195 on at

    I don't have a Premium license so I just used a SharePoint list and used a similar lookup and grabbed the value that corresponds to the Dev or Production environment.  Thanks!

  • zoso2112 Profile Picture
    134 on at

    @Pstork1 - Regarding Premium licenses with regards to using environment variables in a canvas app, would all users accessing the app be required to have a premium Dataverse license in order for the environment variables to function?  Thank you. 

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    If you want to access the Environment variables directly you'll need to add a Dataverse connection. That will require all users to have a Premium subscription.  As I mentioned you can also retrieve the values using a flow without a Premium license and then return those values to the app.

  • zoso2112 Profile Picture
    134 on at

    @Pstork1 - Thank you for the quick response and the great information. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard