# Pre-Request Scripts and Tests for Flows

**URL:** <https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436>\
**Category:** Help Hub\
**Tags:** tests, pre-request-script, postman-flows\
**Created:** [January 10, 2024, 8:56pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436 "2024-01-10T20:56:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nategerman](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nategerman](https://community.postman.com/u/nategerman)\
**Post date:** [January 10, 2024, 8:56pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436/1 "2024-01-10T20:56:20Z")

</div>

I have been attempting to use flows recently and the ability to generate a web hook immediately that triggers a series of task is great, but the inability to run any scripts is a hammer to the knee of its abilities. Is there any expectation that this function will be added to flows and if so, what does that time line look like.

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [January 10, 2024, 9:25pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436/2 "2024-01-10T21:25:46Z")

</div>

Hi @nategerman

Tests and pre-request scripts will run on requests in flows. However, there are certain things that are not supported, such as updating environment/collection variables.

What tests/scripts have you been trying to run that aren’t working?

---

<div class="post-metadata">

**Author:** ![nategerman](https://avatars.discourse-cdn.com/v4/letter/n/ecae2f/32.png) [@nategerman](https://community.postman.com/u/nategerman)\
**Post date:** [January 10, 2024, 9:51pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436/3 "2024-01-10T21:51:56Z")

</div>

I was initially trying to run a hash for an authorization request, but I was unable to move the hash that was generated in the pre-request script, because you can’t update environmental variables. As an alternative, I was attempting to run a postman echo request that would return the hash, but every time I run the flow, the pre-script request doesn’t seem to run. Where there should be a JSON object, it’s null.

![Screenshot 2024-01-10 at 4.51.33 PM](https://us1.discourse-cdn.com/getpostman/original/3X/d/7/d74a02dc80433ec001bc8f15d82801584914ab0e.png)

 ![Screenshot 2024-01-10 at 4.47.44 PM](https://us1.discourse-cdn.com/getpostman/original/3X/c/2/c2de6f502cf42264633450720a444a58c9e45cad.png)

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [January 10, 2024, 10:31pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436/4 "2024-01-10T22:31:19Z")

</div>

Hi @nategerman

Thanks for the additional context. We are working on a better way of achieving things like this.

I believe what you are trying to do with postman echo api is achievable using the GET method and url variable instead:

 ![Screenshot 2024-01-10 at 2.17.14 PM](https://us1.discourse-cdn.com/getpostman/original/3X/d/5/d567aab1bca573fff6f4ed961c612497f3ce90ac.png)

 ![Screenshot 2024-01-10 at 2.17.28 PM](https://us1.discourse-cdn.com/getpostman/original/3X/8/1/813a553eee7d05ae72e6772f4721be73f9213d19.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [January 13, 2024, 10:31pm UTC](https://community.postman.com/t/pre-request-scripts-and-tests-for-flows/56436/5 "2024-01-13T22:31:25Z")

</div>

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