Environment variables in flows

I’ve recently embarked on transferring all my processes into Flows - so far it’s looking like a great solution, but there’s one snag I’ve come across.

I’m aware you can reference environment variables in a request block, by setting the environment on it. However, I’ve been unable to reference any environment variables outside a request block - in particular, in an evaluate block. Is there any way to pull environment variables into an evaluate block so I can transform them before passing them into a request block?

For example - I have a generic request that I want to use several times in a flow, each time passing in a different value for the variable ‘resourceGroupName’:
image
These values need to be calculated based on environment variables, but I haven’t been able to work out how to get environment variables into the flow before the request block.

Hi @samkirby

Welcome to the forums!

We don’t currently have a way to get Environment Variables outside of the Send Request block at this time (we do have a feature request for this open though, which I will add you to).

You can use a pre-request script to calculate dynamic values based on environment variables for your request like below:

Alternatively you could place the values on the Flows canvas instead of in the environment (like in a string block) or have the values be served from an external API.

Hi @flows-daniel, thanks for your reply!

I haven’t tried pre-request scripts, so I’ll have a look - though I have a feeling it may not work for my case, as I’d like to feed a different value into the same request each time I use it in the flow.

For now, I have been using string blocks in the flow as you suggest.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.