Newman does use current variable value

I have a request which inserts some data and the ID should be incremented every time by +1. The request is working fine in Postman runner, but not in Newman where is fails after 1st execution.

PRE-REQUEST SCRIPT - Get the variable value and increate is by 1

let x = pm.environment.get(“SystemSettingTypeIncrementer”);
pm.environment.set(“SystemSettingTypeIncrementer”, Number(x) + 1);

TEST SCRIPT - Set the variable value with new value

pm.environment.set(“SystemSettingTypeIncrementer”, jsonData.Type);
console.log(“SystemSettingTypeIncrementer is set to:”, jsonData.Type);

Fails with what error?

Are you including your environment file in the Newman command line?

If you’ve already set and increased the variable in the pre-change test script, why do you need to do it again in the test script?

What is SystemSettingTypeIncrementer? A JSON object or a number? It looks like you are mixing data types.