# postman.setNextRequest() ignore other requests in collections

**URL:** <https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787>\
**Category:** Help Hub\
**Tags:** workflows\
**Created:** [June 6, 2019, 8:07am UTC](https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787 "2019-06-06T08:07:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehran.shafqat](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@mehran.shafqat](https://community.postman.com/u/mehran.shafqat)\
**Post date:** [June 6, 2019, 8:07am UTC](https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787/1 "2019-06-06T08:07:21Z")

</div>

Hi im using postman.setNextRequest() in my first request and calling the third request and with that its always ignore my 2nd request and end the collection.

I want to run my 2nd request as well afterpostman.setNextRequest() call.

Is there any way fro that ?

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [June 6, 2019, 8:41am UTC](https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787/2 "2019-06-06T08:41:02Z")

</div>

Assuming your requests are in this order in your collection 1 \> 2 \> 3 and you want to run your requests in the below order using `postman.setNextRequest()`  
1 \> 3 \> 2?

`postman.setNextRequest()` is working as expecting in your example.

If you want to call request 2, then you’d need to use `postman.setNextRequest("name-of-request-2")` in request 3, so after request 3 has been completed it’ll run request 2.

Bear in mind, that after request 2 it’ll naturally go to the next request in your collection which would be 3.  
So you’d want to use the below in request 2 to end the test run:

```auto
postman.setNextRequest(null);

```

Hopefully that made sense?

Also, if you want to run your test collection in the order 1 \> 3 \> 2, why not just move the 3rd request so it’s the 2nd request in the collection so it’ll naturally run in the order you want without using `postman.setNextRequest();`

---

<div class="post-metadata">

**Author:** ![ysaead](https://avatars.discourse-cdn.com/v4/letter/y/898d66/32.png) [@ysaead](https://community.postman.com/u/ysaead)\
**Post date:** [April 8, 2020, 6:17pm UTC](https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787/3 "2020-04-08T18:17:09Z")

</div>

> [@postman-paul540](#):
>
> postman.setNextRequest(null);

This is not working in the pre-req or anywhere for that matter:

postman.setNextRequest(null);  
postman.setNextRequest(“null”);

I even created a “null” get request to see if the jump would work but it didn’t. The pre-req is supposed to stop the request from running but it isnt.

Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [April 27, 2020, 9:02am UTC](https://community.postman.com/t/postman-setnextrequest-ignore-other-requests-in-collections/5787/4 "2020-04-27T09:02:47Z")

</div>

All code will be executed BEFORE the `setNextRequest` command is executed.

[https://learning.postman.com/docs/postman/collection-runs/building-workflows/](https://learning.postman.com/docs/postman/collection-runs/building-workflows/)

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/d/d4cecb28fb2dd86f954ee67ee959504bdb28183f.png)

If I have 3 requests, named “1st Request”, “2nd Request” and “3rd Request” inside a collection.

If “1st Request” has the below code in its “Pre-request script tab”, it will hit the 1st Request, skip the 2nd and hit the 3rd Request.

![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/8/889df1eaa3de101753b52d0b5ca1239c8c57d781.png)
