# Set Next Request if certain criteria met?

**URL:** <https://community.postman.com/t/set-next-request-if-certain-criteria-met/5026>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [April 17, 2019, 9:34am UTC](https://community.postman.com/t/set-next-request-if-certain-criteria-met/5026 "2019-04-17T09:34:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natasha.HildrewBrown](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/natasha.hildrewbrown/32/2981_2.png) [@Natasha.HildrewBrown](https://community.postman.com/u/Natasha.HildrewBrown)\
**Post date:** [April 17, 2019, 9:34am UTC](https://community.postman.com/t/set-next-request-if-certain-criteria-met/5026/1 "2019-04-17T09:34:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 17, 2019, 10:11am UTC](https://community.postman.com/t/set-next-request-if-certain-criteria-met/5026/2 "2019-04-17T10:11:45Z")

</div>

Hey @Natasha.HildrewBrown,

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.

---

<div class="post-metadata">

**Author:** ![postman-paul540](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/postman-paul540/32/149_2.png) [@postman-paul540](https://community.postman.com/u/postman-paul540)\
**Post date:** [April 17, 2019, 2:08pm UTC](https://community.postman.com/t/set-next-request-if-certain-criteria-met/5026/3 "2019-04-17T14:08:13Z")

</div>

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

> [@My Code Snippets From The London Postman Summit - Paul Farrell](https://community.postman.com/t/my-code-snippets-from-the-london-postman-summit-paul-farrell/4591):
>
> Hey all, First of all, it was great meeting some of you that attended the Postman event. For those attended, I hope you enjoyed or got something out of my talk slight_smile I’ve been asked to upload the slides I used during my talk but the slides on their own are pretty pointless, as 90% of the content was me talking over images. So I’ll just upload the code examples used in the last third of the slides. For those that didn’t attend or need their memory jogging - this is about using “hooks”…
