# Collection Variable not updated from Post Request Script

**URL:** <https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052>\
**Category:** Help Hub\
**Tags:** variables, collections, scripts\
**Created:** [September 24, 2025, 12:14pm UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052 "2025-09-24T12:14:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![avionics-pilot-27400](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@avionics-pilot-27400](https://community.postman.com/u/avionics-pilot-27400)\
**Post date:** [September 24, 2025, 12:14pm UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/1 "2025-09-24T12:14:23Z")

</div>

Collection variable is not updating from my post request script:

script:

```auto
let decryptVerifier = eval(pm.globals.get("decryptVerifier"));let decryptedPayload = JSON.parse(decryptVerifier(JSON.stringify(pm.response.json())));console.log('decryptedPayload,decryptedPayload')console.log("decryptedPayload.loanDetails =>> ",decryptedPayload.thirdPartyLoanDetails.eligibilityRequestId)const eligibilityRequestId = decryptedPayload.thirdPartyLoanDetails.eligibilityRequestId;console.log("eligibilityRequestId==>> " , eligibilityRequestId)

```

decrypted payload:

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

note:  
script work when valu is set as global variable

---

<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:** [September 24, 2025, 2:08pm UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/2 "2025-09-24T14:08:34Z")

</div>

I can’t see anywhere in that script where you set or use a collection variable.

```javascript
let decryptVerifier = eval(pm.globals.get("decryptVerifier"));

let decryptedPayload = JSON.parse(decryptVerifier(JSON.stringify(pm.response.json())));

console.log('decryptedPayload,decryptedPayload')
console.log("decryptedPayload.loanDetails =>> ", decryptedPayload.thirdPartyLoanDetails.eligibilityRequestId)

const eligibilityRequestId = decryptedPayload.thirdPartyLoanDetails.eligibilityRequestId;
console.log("eligibilityRequestId==>> ", eligibilityRequestId)

```

---

<div class="post-metadata">

**Author:** ![avionics-pilot-27400](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@avionics-pilot-27400](https://community.postman.com/u/avionics-pilot-27400)\
**Post date:** [September 25, 2025, 3:25am UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/3 "2025-09-25T03:25:10Z")

</div>

Sorry, it was a mistake.  
here is the actual post script used.

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

---

<div class="post-metadata">

**Author:** ![lednik](https://avatars.discourse-cdn.com/v4/letter/l/2bfe46/32.png) [@lednik](https://community.postman.com/u/lednik)\
**Post date:** [September 25, 2025, 7:17am UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/4 "2025-09-25T07:17:55Z")

</div>

same issue as this topic:

> [@After latest update saving variables in post-request script are not consistent anymore](https://community.postman.com/t/after-latest-update-saving-variables-in-post-request-script-are-not-consistent-anymore/84370/9):
>
> I have this issue too, it’s an absolute basic request to get an access token. No collection or multiple requests. Only since latest update where we lost the intial value option. Used postbot to confirm the post-response script. It even has a test to confirm the response value is set to the environment, and then i print to console. All good. But opening the environment tab and it’s not updated. Tried another request to use the variable in case it was a UI thing and it’s printing blank too. con…

seems like more and more people have this issues. unfortunately there is no fix yet

---

<div class="post-metadata">

**Author:** ![apoorvgupta03](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@apoorvgupta03](https://community.postman.com/u/apoorvgupta03)\
**Post date:** [September 25, 2025, 7:37am UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/5 "2025-09-25T07:37:05Z")

</div>

Hey folks, sorry you had to face this issue.  
Can you please try logging out and logging back in the app once and run the scripts again?  
This will clear your local current values of variables, but the scripts should set the correct values of variables from there on.

---

<div class="post-metadata">

**Author:** ![vikpaw](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vikpaw/32/33597_2.png) [@vikpaw](https://community.postman.com/u/vikpaw)\
**Post date:** [September 25, 2025, 7:23pm UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052/6 "2025-09-25T19:23:21Z")

</div>

Well.

Logging out and back in, meant I lost ALL my environment variables!

Still not used to this new method of working.

There’s no longer a save button in the environment, so how am I supposed to ensure all my environment variables are actually saved and can survive logging out. Do I have to share them?

I’ve tried sharing a couple of the variables, but the script is still not updating them, yet, as per my post in the thread linked earlier, during post-response script execution i run a test which checks the environment variable matches the value in the response. How is it doing this test and showing success, then not actually saving it?

Any guidance appreciated.
