I am new to postman. I have 6 requests collection and I am using variables that pass from these requests.
In request 3 I am using the If else statement and postman.setNextRequest to ensure that the request goes in loop until I get the required parameters, once I get the parameters I should run the next request which is mentioned in the else statement.
The request in the else statement does not seem to run when I run the collection. In the collection runner I do not see any error either. After request 3 runs, request 4, 5 and 6 should run.
When I run requests 1, 2, 3, 4, 5, 6 individually, all of them work as expected. When I run them as a collection It executes until request 3 which is in loop and the request 4, 5, 6 do not run.
Please help me understand how I can fix this issue. Please check the code below -
Request 3: i.e "Get Dataflow Execution Time 2"
bodyData = JSON.parse(responseBody);
if (responseCode.code === 200 && bodyData.dataflowJobs[0].status !== "Success" && bodyData.dataflowJobs[0].label === "MyOpps_Data_Dataflow") {
// Request 3 which is in loop until I get the status === "success"
postman.setNextRequest("Get Dataflow Execution Time 2");
} else {
postman.setNextRequest("Schedule Recipe"); // Request 4
var current_timestamp = new Date();
console.log(current_timestamp.toISOString())
}