Environment variables
Flows often require different configuration across your environments and this is where environment variables come handy. Environment variables allow you to store different configuration variables in each of your environments or to fallback to a default value.
I just recently used them to define the "sender" (name of a queue) of a notification e-mail in a flow.
Define environment variables
You can add a new environment variable via the new maker studio (make.powerapps.com), by opening one of your solutions and click on New -> Environment variable:
After having defined your default and environment specific value it should look like that:
Using environment variables in a flow
To retrieve the value of an environment variable, we add a list records action, where we search for the environment variable by schema name and expand the query with the environment specific value (stored in a linked entity):
Finally we initialize a variable, where we either set the default value (if no environment specific value is set) or the environment specific value via following formula:
if(
empty(body('List_records')?['value']?[0]?['environmentvariabledefinition_environmentvariablevalue']?[0]?['value']),
body('List_records')?['value']?[0]?.defaultvalue,
body('List_records')?['value']?[0]?['environmentvariabledefinition_environmentvariablevalue']?[0]?['value']
)
Result
If we test our flow, this is our result:
We can now use this variable, to fetch the queue with this name to reference it as a sender for our notification.
Comments
Post a Comment