Postman doens't run all the requests in if/else statement

Hello to all,

I am pretty rookie working in Postman so I would very much appreciate your help, please.


-POST request1
-POST request2
-POST request3

I need to run these 3 POST requests based on some conditions.
Here is my script in the Collection Pre-request Scrip:

if ( === "request1") {
     //use userId1 and userName1

} else if ( === "request2" || === "request3")
    //use userId2 and userName2

When I run the collection with the collection runner, postman runs “request1” and “request2” but not request3

Any idea of the reason why and how can I fix it?

Thanks in advance

L.E. I just realized that my script is no good because all of the conditions are true, sorry for the rookie mistake

Basically I need to run all 3 requests but the code ran is different, I changed the scrip with what I actually need (use different userId and userName)

Hi @silvixqa. Welcome to the Postman Community!

You want each of the three request to run, but each one should only run if they meet a specific condition and be skipped if they don’t meet that condition. Is this correct?

If only request A and C meets their conditions, then run A and C, but skip request B?