Set Next Request if certain criteria met?

Hi!
I was wondering if it is possible to use set the next request function if certain criteria are met in a return. For example, based on complete/incomplete: if gameComplete = true follow 1 path or if gameComplete = false follow another?

Hey @Natasha.Brown,

Thank you for the question.

You should be able to achieve this with an if statement within the Tests tab, to control the workflow.

if(gameComplete) {
    postman.setNextRequest("Path 1");
} else {
    postman.setNextRequest("Path 2");
}

Something basic like this should work when running the Collection in the Runner.

1 Like

@Natasha.Brown
Feel free to check out my slides from the London Postman Summit were I’m using setNextRequest() a lot.

2 Likes