# Unable to .setNextRequest to work

**URL:** <https://community.postman.com/t/unable-to-setnextrequest-to-work/47161>\
**Category:** Help Hub\
**Tags:** tests, setnextrequest\
**Created:** [May 6, 2023, 12:02am UTC](https://community.postman.com/t/unable-to-setnextrequest-to-work/47161 "2023-05-06T00:02:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![altimetry-administ10](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@altimetry-administ10](https://community.postman.com/u/altimetry-administ10)\
**Post date:** [May 6, 2023, 12:02am UTC](https://community.postman.com/t/unable-to-setnextrequest-to-work/47161/1 "2023-05-06T00:02:48Z")

</div>

I have folder 1 in my collection with some requests, say R1, R2, R3, R4, and R5. I want to be able to run R1\>R4\>R2\>R4\>R3\>R4\>R5. What is the best approach to this? I tried many things in the collection runner, but nothing seems to work. I can move R4 and R5 to another folder; however looks like R4 and R5 must be in the same folder for .setNextRequest to work.  
I have tried the below

#1 I added R4 to the tests section in folder 1, but since R4 is also part of folder 1, it becomes an infinite loop.

#2 Added R4 as .setNextRequest to the tests section in each request R1, R2, and R3. I added null as .setNextRequest in R3 and ran it in the runner, but only R1 and R4 are getting executed and not going beyond it.

#3 Brute forced this in R1 tests section  
.setNextRequest (R4);  
.setNextRequest (R2);  
.setNextRequest (R4);  
.setNextRequest (R3);  
.setNextRequest (R4);  
.setNextRequest (R5);

Dint work beyond the first .setNextRequest (R4);

#4 Added .setNextRequest(R4) in folder 1 tests section and added .setNextRequest(null) to the R4 tests section. This runs R1\>R4\>R4

PS: I am selecting all the requests in the collection runner (in the sequence R1\>R2\>R3\>R4) as pointed in another thread. I also sequenced R1\>R2\>R3\>R4 in multiple sequences with the runner, nothing worked.  
I haven’t even reached the point of running R5. I’m not sure what I’m missing?

---

<div class="post-metadata">

**Author:** ![altimetry-administ10](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@altimetry-administ10](https://community.postman.com/u/altimetry-administ10)\
**Post date:** [May 9, 2023, 4:11am UTC](https://community.postman.com/t/unable-to-setnextrequest-to-work/47161/2 "2023-05-09T04:11:28Z")

</div>

Anyone has any ideas?

---

<div class="post-metadata">

**Author:** ![altimetry-administ10](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@altimetry-administ10](https://community.postman.com/u/altimetry-administ10)\
**Post date:** [May 9, 2023, 5:51am UTC](https://community.postman.com/t/unable-to-setnextrequest-to-work/47161/3 "2023-05-09T05:51:19Z")

</div>

Got it to work!! Thanks community!
