# Environment variable does not create or update while running a collection

**URL:** <https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129>\
**Category:** Help Hub\
**Created:** [March 31, 2021, 11:40am UTC](https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129 "2021-03-31T11:40:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![charleslandvoice](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@charleslandvoice](https://community.postman.com/u/charleslandvoice)\
**Post date:** [March 31, 2021, 11:40am UTC](https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129/1 "2021-03-31T11:40:29Z")

</div>

Hello all. I noticed while running a collection my environment variable doesn’t get updated. I deleted the environment variable and tried running the collection again to see if the env variable will be created and updated correctly. I noticed that the env variable does not get created, but I noticed that when I log the environment variable that I just created it returns a value.

 ![Screen Shot 2021-03-31 at 1.22.37 PM](https://us1.discourse-cdn.com/getpostman/original/3X/e/9/e9023092c617e8bf607c625a7c60c173ae19a212.png) ![Screen Shot 2021-03-31 at 1.25.05 PM](https://us1.discourse-cdn.com/getpostman/original/3X/8/8/886cf5de7194312894d11c1d51932cfc5279b396.png) ![Screen Shot 2021-03-31 at 3.40.03 PM](https://us1.discourse-cdn.com/getpostman/original/2X/7/7fe7d86c9629fc2b4904a57a0fc13889572005db.png)

---

<div class="post-metadata">

**Author:** ![thefierycoder](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@thefierycoder](https://community.postman.com/u/thefierycoder)\
**Post date:** [March 31, 2021, 12:12pm UTC](https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129/2 "2021-03-31T12:12:59Z")

</div>

Hello there,  
Have you selected the correct environment?

---

<div class="post-metadata">

**Author:** ![charleslandvoice](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@charleslandvoice](https://community.postman.com/u/charleslandvoice)\
**Post date:** [March 31, 2021, 12:28pm UTC](https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129/3 "2021-03-31T12:28:52Z")

</div>

Yes, I have.

 ![Screen Shot 2021-03-31 at 4.28.19 PM](https://us1.discourse-cdn.com/getpostman/original/3X/a/9/a94f4ae7a77ceb258c4c4353cee3dfd1033df747.png)

---

<div class="post-metadata">

**Author:** ![thefierycoder](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@thefierycoder](https://community.postman.com/u/thefierycoder)\
**Post date:** [March 31, 2021, 12:49pm UTC](https://community.postman.com/t/environment-variable-does-not-create-or-update-while-running-a-collection/22129/4 "2021-03-31T12:49:24Z")

</div>

Are you saving the env variable from the test script of the same request that is accessing the variable?  
If this is the case you can’t able to access that.  
Please share your code or if possible share your workspace url
