Hi! That’s my bad for committing such obvious mistake. Thank you for pointing it out.
So after fixing variable assignment it (almost) worked as intended but I got another error that pm.setNextRequest is not a function but THAT post helped me with that error. Working code is below:
let chunks = pm.environment.get("chunks"); //515
let chunk = pm.environment.get("chunk"); //0
if (parseInt(pm.environment.get("chunk")) <= parseInt(pm.environment.get("chunks"))) {
parseInt(pm.environment.set("chunk", 1+Number(chunk)));
console.log(`Chunk number after incrementation is: ${pm.environment.get('chunk')}`);
postman.setNextRequest("02. Perform the upload of chunks");
} else {
postman.setNextRequest("03. Finish the upload (no more chunks)");
}