postman.setNextRequest not working


I have this GET and POST in same collection and even in the same folder.
At the end of GET tests I call the POST using this postman.setNextRequest(“EmailNotifier”);
but nothing happen, it doesn’t run the POST for sure (just to make clear, when I manually run it is working fine).

What I am missing here using the setNextRequest ?

Thank you

Hey @CryptoAngel

Unfortunately, without the rest of the code that you have, that line alone is a bit meaningless.

Could you provide the rest of the script and details of the rest of the collection please. The raw code would be better than a picture of it.

Before doing that, could you confirm that that you have no unsaved changes in the requests that you have open for that collection? The collection Runner won’t know about changes to the request unless you save it before the run.

In addition to what @danny-dainton said, if you’re just running the request out of the app, setNextRequest isn’t going to do anything.

postman.setNextRequest is going to tell the collection runner what the next request is to execute. If you’re not running a collection, it will do nothing.

Also, make sure that the value you have as the argument in setNextRequest is the name of the request you want to run.


Thank you for your comment

I am the request from MacOS app but still it doesn’t work. I’m not using the Runner just manually click on the button to run it.

The setNextRequest is the only thing on the Tests and the name is correct.

Then that is your problem. If you run a request manually it will run one and only one request.

pm.setNextRequest is a collection runner command.

Oh I see. Alright.
There’s no command line to call another request without the runner?

No there isn’t. You could possibly call another request via the javascript in the tests section, but I don’t think that’s a very good workaround because the collection runner does this for you already.

But to check if it’s working I need to run the Runner instead of clicking the button.
And anyhow, I added single line postman.setNextRequest(“EmailNotifier”); in the first request “Tests” and I ran the Runner but still nothing happened, it did not run the second request “EmailNotifier”

1 Like

Are you able to show us an image of what that flow looks like, what those requests look like, the names of the requests and what is the saved state of each one.

By not showing people what you have in front of you - saying “I doesn’t work” is not going to help :slight_smile:

Worth reading this doc from our learning center and the points at the bottom as some might be relevant to what you’re seeing here.

Can anyone please help me to do this
I want to run 1 common request after each request but here only 1st request followed by common req is running.

I want Req_1 then common, then Req_2 then common then Req_3 then common, then Req_4 then common.

Inside test of Req_1/2/3/4 I have below:


but after running collection I got output as Req_1 and Common (2 req)

Hey @ngeeta123 :wave:

Welcome to the Postman community! :postman:

Can you provide your actual code and images of what you have in the app, please?

Without all the information, it’s difficult for anyone to suggest what might be the problem.

Ensure that all requests are saved as unsaved changes wouldn’t reflect in an existing Collection Run.

Hey danny,
Check below image,

and below script in all Req

let jsonData=pm.response.json();


What’s not working?

Your conditional statement is evaluated to true in the first request (because it’s basically checking that you have a response body) and then it’s going to the Common request.

Correct but I want Req_2 also execute followed by common.then req_3 followed by common and then req_4 followed by common.
this is working on only Req_1

Inshort after running collection, I want 8 request should execute


It’s working that way because it’s going to the Common request and then, as that’s the final request in the Collection, it’s ending the run.

You would need to add logic to the Common request to direct it back to the other requests if that’s what you want to do.

Without something telling it to go to the other requests, how would it know to do that.

thats the logic I want how to implement

What have you tried so far?

Do you need to do it that way or would having an async call using pm.sendRequest() to that Common request, from the Tests tab work here?

Basically, it’s all example code at the moment and I have no idea what those requests are actually doing and why you need to keep hitting that Common request each time.

I’ve removed your same comment/question on the other topic, that was last active 3 years ago and you created this one for the same thing. Your question should have ideally been it’s own topic and not piggybacking on something that’s not exactly related.

I want the logic to run common request after each request thats it.
any method or logic will be ok.
If you can help me with any other option plz help.

I will take a closer look today and create a reusable solution.

This is a common question that pop up a lot and should have it’s own demo Collection in the Postman Answers Workspace.

I know that @michaelderekjones might have a quick solution around this in the short term and he’s very familiar with the setNextRequest() logic.

I can think of two options.

Put the four requests in a folder or collection, and then add the common request into the tests tab of the folder or collection using sendRequest(). It’s more code, but isn’t that the essence of why you have a tests tab/pre-request scripts at the collection, folder and request level.

No setNextRequest involved. This will run after every request in the folder.

Option 2 would be to track the next request to be run after the common request in the tests tab of each of the requests.

So in Req-1, you would save an collection variable with the value of the Req_2 name and then use setNextRequest in Req-1 to call the common request.

In Req-2, you would update the value to show the Req-3 name.

In the tests tab of the common request, you would retrieve the previously saved variable and use that to drive the setNextRequest().

For request 4, you would set the value of this variable to “null” to end the flow.

Personally, I would recommend an update to setNextRequest() or a new feature that allows you to set the next two requests. Or a flag, that if set will allow you to call another request once and then continue running the tests in the current folder or collection. The first option would probably be easier to implement but the second would be more user friendly.

The idea here is that re-usable code or requests is a key factor for a lot of automated testing frameworks. If you have dozens of collections that use the same request\feature. You only need to update it in one place. Its one thing that Postman is missing as a concept.