postman.setNextRequest not doing anything


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 @dannydainton 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.

1 Like

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”

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.