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 / Get Default Value of P...
Power Apps
Unanswered

Get Default Value of Power Apps Environment Variables

(0) ShareShare
ReportReport
Posted on by

we are reading using the Environment variable in the canvas power apps using the below code

 

Set(

            varSecurityGroupI,

            LookUp(

                'Environment Variable Values',

                'Environment Variable Definition'.'Display Name' = "SecurityGroupId"

            ).Value

       )

But using the above I am able to read only the Current Value.

I would like to know if is there any way to read the Default value of the environment variable. 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @TarunEY the documentation only mentions:

    Environment variables can be created and modified within the modern solution interface ...
    they can be used as inputs when authoring canvas apps, Power Automate flows

    Environment variables can be changed from the solution interface and not the app editor. Environment variables are mainly used to avoid 'hardcoded values' that might change across environments. If the values change within the app itself, you might need a global variable.

    If this solves your questions, would you be so kind as to accept it as a solution.

    Thanks!

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @LaurensM That does not really answer the question, for example the formula given by @TarunEY works so far to read the current value.

     

    @TarunEY  Try this instead for the default value.

     

    LookUp(
     'Environment Variable Values',
    
     'Environment Variable Definition'.'Display Name' = "SecurityGroupId"
    
     ).'Environment Variable Definition'.'Default Value'

     

     

    I tested it and it worked for me.

     

    So you can try this

    Set(
    
     varSecurityGroupI,
    
     LookUp(
    
     'Environment Variable Values',
    
     'Environment Variable Definition'.'Display Name' = "SecurityGroupId"
    
     ).'Environment Variable Definition'.'Default Value'
    
     )

    Does it work for you now @TarunEY ?

  • LaurensM Profile Picture
    12,516 Moderator on at

    @poweractivate thanks for the correction. For some odd reason I read the last sentence as 'Is there some way to change data of the environment variable in the app'.

    Reading indeed will work 😁

  • TarunEY Profile Picture
    on at

    @poweractivate  

     

    Thanks for the quick response. Your code is not working if we delete the current value for the variable using the Delete from this Environment. and working fine if we use the option Remove from Solution. Not Sure why it was behaving like this. Am I doing anything wrong?

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 774 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 335 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 248

Last 30 days Overall leaderboard