# Newman does use current variable value

**URL:** <https://community.postman.com/t/newman-does-use-current-variable-value/38493>\
**Category:** Help Hub\
**Tags:** newman-project, variables\
**Created:** [August 24, 2022, 8:30am UTC](https://community.postman.com/t/newman-does-use-current-variable-value/38493 "2022-08-24T08:30:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xUrko](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/xurko/32/9969_2.png) [@xUrko](https://community.postman.com/u/xUrko)\
**Post date:** [August 24, 2022, 8:30am UTC](https://community.postman.com/t/newman-does-use-current-variable-value/38493/1 "2022-08-24T08:30:17Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

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);

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [August 24, 2022, 11:05am UTC](https://community.postman.com/t/newman-does-use-current-variable-value/38493/2 "2022-08-24T11:05:21Z")

</div>

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.
