Checking dynamic variables in pre-request script

Hi @rafall92

If you want to have it determined if you need to run your Request, what I usually end up doing (not sure if there is a better way) is to create a Request that runs before the request that you use.

Example:

Request 1 (“DataCheck”):
No Pre-Request script
Have request use Get, if you have an endpoint that is a ping response, use that
Tests
if(pm.iterationData.get(‘name’) == “”) {
postman.setNextRequest(null);
} else {
postman.setNextRequest(“MyRequest”);
}

Request 2 (“MyRequest”):
*This is your script

Hope this helps!