# setNextRequest behavior

**URL:** <https://community.postman.com/t/setnextrequest-behavior/10460>\
**Category:** Help Hub\
**Tags:** setnextrequest\
**Created:** [January 30, 2020, 6:17pm UTC](https://community.postman.com/t/setnextrequest-behavior/10460 "2020-01-30T18:17:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jont](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jont](https://community.postman.com/u/jont)\
**Post date:** [January 30, 2020, 6:17pm UTC](https://community.postman.com/t/setnextrequest-behavior/10460/1 "2020-01-30T18:17:59Z")

</div>

postman version:7.16.1

I am relatively new to postman scripting and am struggling with correct usage of setnextRequest… guidance is much appreciated. I have read the docs and several posts about it.

I have request A and request B. A is a “POST”, B is a GET".

The PreRequest script for B looks like this:  
if {  
postman.setNextRequest(‘Request A’)  
}

I start collection runner and execute “Request B” only.

expected behavior:  
Request B execution followed by Request A execution.

actual behavior:  
B executes but fails with a 401 status. This 401 was expected.  
A never executes

## question

Why does A not execute? Is setNextRequest effective only if the currently executing request(B in my case) is successful?

---

<div class="post-metadata">

**Author:** ![jont](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jont](https://community.postman.com/u/jont)\
**Post date:** [January 30, 2020, 10:33pm UTC](https://community.postman.com/t/setnextrequest-behavior/10460/2 "2020-01-30T22:33:51Z")

</div>

I think I got it sorted out. In collection runner I had to select both method A and B for this work and move B ahead of A in the execution list. Otherwise, setNextRequest will not launch A after B.
