# Environment variables saving not working

**URL:** <https://community.postman.com/t/environment-variables-saving-not-working/79374>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [April 30, 2025, 8:52am UTC](https://community.postman.com/t/environment-variables-saving-not-working/79374 "2025-04-30T08:52:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![supply-participant18](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@supply-participant18](https://community.postman.com/u/supply-participant18)\
**Post date:** [April 30, 2025, 8:52am UTC](https://community.postman.com/t/environment-variables-saving-not-working/79374/1 "2025-04-30T08:52:40Z")

</div>

Hello.  
I experience problem with persisting values of variables in environment and globals.  
I manually added new variable in environment ‘ **MyVar** ’ and set value (initial and current) to ‘MyVarVal’ (and clicked button ‘Save’).  
And in script I have following code:

- let myVar = pm.environment.get(“MyVar”);
- console.log("MyVar: ", myVar);  
But in console i see: ‘MyVar: undefined’.

The same behavior I register in case of Globals variables.

Where could be problem? What do I wrong?

Thank you for helpful advice.

---

<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:** [April 30, 2025, 9:26am UTC](https://community.postman.com/t/environment-variables-saving-not-working/79374/2 "2025-04-30T09:26:10Z")

</div>

Do you have the Environment selected?

---

<div class="post-metadata">

**Author:** ![supply-participant18](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@supply-participant18](https://community.postman.com/u/supply-participant18)\
**Post date:** [April 30, 2025, 10:24am UTC](https://community.postman.com/t/environment-variables-saving-not-working/79374/3 "2025-04-30T10:24:58Z")

</div>

Yes, of couse.  
I think there must be bug in the behavior. It I set the variable using scipt (pm.environment.set(‘any value’)) then is the value used.  
But it isn’t reflected in UI. So it looks like a bug in UI.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/2/320684edd90a94d0eb85f637872f80fc8dfc2875.png)
