# Can I check a request has been ran before running another?

**URL:** <https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [August 7, 2020, 10:25am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811 "2020-08-07T10:25:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tigerj3000](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tigerj3000](https://community.postman.com/u/tigerj3000)\
**Post date:** [August 7, 2020, 10:25am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811/1 "2020-08-07T10:25:14Z")

</div>

Hi,

I want a request to check that a previous one has been ran before it runs.  
I would assume that this would be done in a Pre-req. script but I don’t know how it would be done.

For context:  
Request names:  
\> prereq  
\> project  
\> executionid  
\> testid

I want the requests “project”, “executionid” and “testid” to check that the prereq request has been executed.

The prereq stores variables in the environment that the three tests below use so I was thinking that I could check that those variables are present before running them but I wanted to know if there is a better way to do this.

I am using the Postman for Windows v7.29.1

Many thanks.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [August 7, 2020, 11:39am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811/2 "2020-08-07T11:39:11Z")

</div>

Is your goal here to prevent the last three requests from executing at all if “prereq” didn’t run successfully?

If you have them as separate requests in your collection, you are guaranteeing order.

---

<div class="post-metadata">

**Author:** ![tigerj3000](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tigerj3000](https://community.postman.com/u/tigerj3000)\
**Post date:** [August 10, 2020, 7:58am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811/3 "2020-08-10T07:58:59Z")

</div>

Hi,  
Yes - that’s what I’m expecting but I have other requests both before and after these that need to be run as well. Meaning that if prereq fails I don’t want everything after to fail also.

They are all in the same collection and in that specific order

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [August 10, 2020, 11:34am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811/4 "2020-08-10T11:34:55Z")

</div>

Ok great, if that’s the case then you can keep everything as separate requests and just use `postman.setNextRequest` to build your conditional workflow.

[Postman Documentation](https://learning.postman.com/docs/running-collections/building-workflows/)

---

<div class="post-metadata">

**Author:** ![tigerj3000](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tigerj3000](https://community.postman.com/u/tigerj3000)\
**Post date:** [August 11, 2020, 10:40am UTC](https://community.postman.com/t/can-i-check-a-request-has-been-ran-before-running-another/14811/5 "2020-08-11T10:40:04Z")

</div>

Thanks for this, helps a lot!
