Environment variable not updated in flows

I have found a few topics on this issue from previous poster, but it isn’t clear to me what i have done wrong and the responses haven’t always helped. When i run these http request in collection one at a time, there is no issue. The environment variable updates, and I can pass this into future requests in order to continuing testing. In flows however, a user is create, the id is generated, but the variable doesn’t update leading to issues further down the line. Am I missing something?

The addition of the get and create variable here are attempts to try and get the problem (uncessfull). I had originally simply ran a post-script for when the user is created

// Save user ID as an environment variable

pm.environment.set("user_id", responseJson.id);

});

Thank you in advance

Hi @orbital-module-tec12

Welcome to the forums!

We don’t support updating Environment variables from within Flows at this time.

From your screenshot, you have two choices:

  1. Directly connect Create User to Update User and then select the path to user_id [Docs Example]
  2. You will need a select block before your create variable block user_id in order to parse out just the user_id field. Then your get variable block can be used as the input for user_id in your Update User request rather than the send port that it’s connected to now

Let me know if you run into any further issues!

Hi @orbital-module-tec12 , want to let you know that Request pre/post-scripts can now mutate environment variables within Flows (only supported in flow modules for now). Steps to follow:

  1. Upgrade to the latest app version.
  2. Open your flow module.
  3. Hover over your HTTP Request block, select the gear icon, and ensure “Allow scripts to update environment variables” is enabled.

Here’s a small video showing these steps: