# Is there a way to run the pre-request script only once?

**URL:** <https://community.postman.com/t/is-there-a-way-to-run-the-pre-request-script-only-once/26869>\
**Category:** Help Hub\
**Created:** [August 18, 2021, 7:21pm UTC](https://community.postman.com/t/is-there-a-way-to-run-the-pre-request-script-only-once/26869 "2021-08-18T19:21:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TesterShaner](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@TesterShaner](https://community.postman.com/u/TesterShaner)\
**Post date:** [August 18, 2021, 7:21pm UTC](https://community.postman.com/t/is-there-a-way-to-run-the-pre-request-script-only-once/26869/1 "2021-08-18T19:21:31Z")

</div>

I have a list of values, and it randomly selects one. But I want it to persist throughout the requests and not run everytime before every request like it says it does. Is there a way to run it once per test instead of once before every request?

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [August 19, 2021, 4:45am UTC](https://community.postman.com/t/is-there-a-way-to-run-the-pre-request-script-only-once/26869/2 "2021-08-19T04:45:50Z")

</div>

Hi @TesterShaner,

One way to achieve this is to set up a flag in the collection variable. And check for the status of the flag before executing the pre-requisite steps for each request.

When you run your first request the flag will be updated. Since all your requests scripts check for the flag, they will not execute unless the find unset value of flag.
