Skip to content

Instantly share code, notes, and snippets.

@GrimDerp
Forked from JamesMessinger/set-next-request.js
Created January 31, 2022 20:02
Show Gist options
  • Select an option

  • Save GrimDerp/4e818c15df9915ce9699dd560451dd0e to your computer and use it in GitHub Desktop.

Select an option

Save GrimDerp/4e818c15df9915ce9699dd560451dd0e to your computer and use it in GitHub Desktop.
setNextRequest() example
var customer = JSON.parse(responseBody);
if (customer.id === undefined) {
// No customer was returned, so don't run the rest of the collection
postman.setNextRequest(null);
}
else {
// Save the customer ID to a Postman environment variable
postman.setEnvironmentVariable("cust_id", customer.id);
// The "Edit Customer" request uses the "cust_id" variable
postman.setNextRequest('Edit Customer');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment