Postman.setNextrequest method doesn’t work in postman

Postman.setNextrequest doesn’t work. I tried with multiple ways, but still not working
My requirement to run a new endpoint after the loop

pm.test("Get code of each countries", function () {
var jsonData = pm.response.json();
    pm.environment.set("variable_key", => value.code));


var country_code = pm.environment.get("variable_key".split(","));

for (var i = 0; i < country_code.length; i++) {
    pm.environment.set("code", country_code[i]);
         postman.setNextRequest("https/Endpoint/country=" + country_code[i]);

pm.test("Status code is 200", function () {;

Can you please help me to resolve this issue ?

Hi @vivekak,

setNext request needs to point to an additional request in the collection. You simply provide the name of the request. Also setNext only works in a runner.

See documentation Building request workflows | Postman Learning Center