Skip to main content

Notifications

Community site session details

Community site session details

Session Id : I+8bab3FIxL+FjaG+LC5d7
Power Apps - Microsoft Dataverse
Answered

Environment Variable for calculated field

Like (1) ShareShare
ReportReport
Posted on 1 Oct 2024 09:15:33 by 254
Hi all, 
I would like to create a new field to my table with dynamic value. 
The value would be a link which is to be built from a base URL + dynamics parameters given by specific fields at the current record. 
Rigth now I have a new field type formula using concatenate function to combine a static base url and values of relevant fields. So far so good. 
But I would like to make this base URL part also dynamic as my Dev system should link the dev instance of the linked page, test to test and production to production. 
So my idea was to create an environment variable to store the base URL, but I did not found the right way to get the current value of this variable into my formula. 
 
Would be happy to get any guide. Thank you!
  • Suggested answer
    abc 123 Profile Picture
    784 Super User 2025 Season 1 on 02 Oct 2024 at 15:45:50
    Environment Variable for calculated field
    My code would be used in a Flow (Power Automate). If you wanted an environment variable in PowerApps, then just store the value in a list, and use the Lookup() function to get and set it.
  • SteRe Profile Picture
    254 on 02 Oct 2024 at 08:11:24
    Environment Variable for calculated field
    Hi all, 
    I want wo provide some update in here. 
    It turned out my initial request can not be fulfilled by the system - there is no option to directly request value of an environment variable within the new field typ formula so far. 
    I understood there are workarounds using workflows or cloud flows to update the value. Works, but in this case I don't need the calculated formula field. I can simply use a string field and set it value with a cloud flow based on chages in other fields. 
     
    I figured out another alternative for my use case. As I would like to like another company-internal website I can also embedd this as an iframe to my form. In this case I need to inject the iframe URL running a little JS. So I have two options now how to solve my problem (POC for both working) and I can check with the users which alternative they prefer from a UX perspective. 
     
    Thanks for your support.
  • Michael E. Gernaey Profile Picture
    42,004 Super User 2025 Season 1 on 01 Oct 2024 at 19:32:51
    Environment Variable for calculated field
    Hi
     
    Once you add the environment variable and you publish it, and you refresh your flow (just reload it), you will be able to add the Environment Variable.
     
    Then when you publish all customizations and you export it as managed, and import it into the next environment, you will update the value on import.
     
    So I dont know why you are having an issue, as you didn't share anything, but what i said and what you did is correct.
     
  • SteRe Profile Picture
    254 on 01 Oct 2024 at 12:04:32
    Environment Variable for calculated field
    @abc_123 do you refer to a direct use in the formula field or a power automate flow to be built to get the value?
  • Verified answer
    abc 123 Profile Picture
    784 Super User 2025 Season 1 on 01 Oct 2024 at 11:47:08
    Environment Variable for calculated field
    The syntax for an environment variable is:
           @{parameters('displayname (new_displayname)')}
     
    You could create a new variable, and then populate it with the environment variable and the "relevant fields".
     
    This is in an Automatic Flow, putting the environment variable, the ID, and a field called AmountConsumed together
    @{parameters('envMyVal (new_envMyVal)')}-@{triggerOutputs()?['body/ID']}-@{triggerOutputs()?['body/AmountConsumed']}
     
           
  • Shashank Bhide Profile Picture
    936 Super User 2025 Season 1 on 01 Oct 2024 at 11:09:44
    Environment Variable for calculated field
    do it with a classic workflow or a power automate or an async plugin.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

#1
stampcoin Profile Picture

stampcoin 11

#3
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

Overall leaderboard

Featured topics