# \#scripts

**URL:** https://community.postman.com/tag/scripts/27.md

[Latest](https://community.postman.com/latest.md) · [Categories](https://community.postman.com/categories.md) · [Tags](https://community.postman.com/tags.md)

---

## [The pm.environment.name method is returning undefined](https://community.postman.com/t/the-pm-environment-name-method-is-returning-undefined/89639)

<div class="topic-metadata">

**Author:** [@dcpanda18usa](https://community.postman.com/u/dcpanda18usa)\
**Replies:** 6\
**Last updated:** [April 8, 2026, 4:52am UTC](https://community.postman.com/t/the-pm-environment-name-method-is-returning-undefined/89639 "2026-04-08T04:52:22Z")

</div>

I have postman collections with environment and have scripts which are checking the postman environment name to do some manipulation. From the past release the “pm.environment.name” is coming up as undefined though I ca…

---

## [Pre-request scripts not working for me](https://community.postman.com/t/pre-request-scripts-not-working-for-me/34396)

<div class="topic-metadata">

**Author:** [@ritvik-saras](https://community.postman.com/u/ritvik-saras)\
**Replies:** 5\
**Last updated:** [March 30, 2026, 6:35pm UTC](https://community.postman.com/t/pre-request-scripts-not-working-for-me/34396 "2026-03-30T18:35:07Z")

</div>

I added some JavaScript in the pre-request script tab for a collection to add some headers but none of them are getting executed. Here is the text I added: pm.request.headers.add({key: “Authorization”, value: “Basic xx…

---

## [Package library missing](https://community.postman.com/t/package-library-missing/88813)

<div class="topic-metadata">

**Author:** [@martinsbrn](https://community.postman.com/u/martinsbrn)\
**Replies:** 2\
**Last updated:** [February 24, 2026, 3:53pm UTC](https://community.postman.com/t/package-library-missing/88813 "2026-02-24T15:53:07Z")

</div>

After the latest updates I had some problems like “can’t see workspaces” which eventually started working again. But I noticed that the “package library” disappeared from the scripts screen and now I can’t use the featur…

---

## [Saving variables in post-request script are not consistent](https://community.postman.com/t/saving-variables-in-post-request-script-are-not-consistent/84370)

<div class="topic-metadata">

**Author:** [@lednik](https://community.postman.com/u/lednik)\
**Replies:** 51\
**Last updated:** [January 23, 2026, 7:09pm UTC](https://community.postman.com/t/saving-variables-in-post-request-script-are-not-consistent/84370 "2026-01-23T19:09:18Z")

</div>

Hi, Since latest update (11.61.9) variables are not saved anymore, they are sometimes but in most cases they are not. I can save some variables in post-request script in to collection variables, i can also verify that …

---

## ["Enable support in scripts" in vault settings is not available for one of our users](https://community.postman.com/t/enable-support-in-scripts-in-vault-settings-is-not-available-for-one-of-our-users/87265)

<div class="topic-metadata">

**Author:** [@spsec](https://community.postman.com/u/spsec)\
**Replies:** 3\
**Last updated:** [December 18, 2025, 5:30pm UTC](https://community.postman.com/t/enable-support-in-scripts-in-vault-settings-is-not-available-for-one-of-our-users/87265 "2025-12-18T17:30:51Z")

</div>

We have a QA person that needs to access vault values in a script to generate credentials. She is using version 11.2 and I’m using version 11.66 and additionally I’m a SuperAdmin and she has a developer role. When she g…

---

## [Postman flows not updating environment variables](https://community.postman.com/t/postman-flows-not-updating-environment-variables/48277)

<div class="topic-metadata">

**Author:** [@avionics-engineer-87](https://community.postman.com/u/avionics-engineer-87)\
**Replies:** 12\
**Last updated:** [December 17, 2025, 4:21pm UTC](https://community.postman.com/t/postman-flows-not-updating-environment-variables/48277 "2025-12-17T16:21:54Z")

</div>

Hi There, I have recently started using postman flow. I really like the feature. However, came across an issue related to updating environment variables and couldn’t find solution. Problem: Request in flows not updati…

---

## [Any flow blocks with Typescript is not working](https://community.postman.com/t/any-flow-blocks-with-typescript-is-not-working/87241)

<div class="topic-metadata">

**Author:** [@vijaymkm1981](https://community.postman.com/u/vijaymkm1981)\
**Replies:** 7\
**Last updated:** [December 10, 2025, 10:17pm UTC](https://community.postman.com/t/any-flow-blocks-with-typescript-is-not-working/87241 "2025-12-10T22:17:20Z")

</div>

Any flow block with Typescript is not working after the upgrade to 11.74.4.

---

## [How can I call an API from the same Collection before calling any API in the Collection](https://community.postman.com/t/how-can-i-call-an-api-from-the-same-collection-before-calling-any-api-in-the-collection/87195)

<div class="topic-metadata">

**Author:** [@flight-meteorologis1](https://community.postman.com/u/flight-meteorologis1)\
**Replies:** 3\
**Last updated:** [December 7, 2025, 3:20pm UTC](https://community.postman.com/t/how-can-i-call-an-api-from-the-same-collection-before-calling-any-api-in-the-collection/87195 "2025-12-07T15:20:22Z")

</div>

I have a list of apis in collection the first of is get Token API now , when i call any other apis from the collection , i want to called that get Token and fill an collection environment variable , how i can do that?

---

## [💡 "Postman Can’t Automatically Clear/Reset Variables"? Here’s How It Can!](https://community.postman.com/t/postman-can-t-automatically-clear-reset-variables-here-s-how-it-can/85605)

<div class="topic-metadata">

**Author:** [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Replies:** 4\
**Last updated:** [October 24, 2025, 10:39pm UTC](https://community.postman.com/t/postman-can-t-automatically-clear-reset-variables-here-s-how-it-can/85605 "2025-10-24T22:39:48Z")

</div>

Background: Community Feedback This post was inspired by a comment from @abdulkabirsultan in a previous weekly challenge, who pointed out that environment variables can linger after runs and cause test issues. ▶ See the …

---

## [Postman TodayDate variable to get past dates](https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290)

<div class="topic-metadata">

**Author:** [@mattschmitt](https://community.postman.com/u/mattschmitt)\
**Replies:** 12\
**Last updated:** [October 23, 2025, 11:03am UTC](https://community.postman.com/t/postman-todaydate-variable-to-get-past-dates/22290 "2025-10-23T11:03:13Z")

</div>

Hi, so I’m stuck on creating a new variable for a past date. I currently have a global variable: pm.globals.set(“todayDate”,parseInt(moment().format(“YYYYMMDD”))) Instead of creating a bunch of different global variabl…

---

## [Executing custom scripts/operations in Postman Flows](https://community.postman.com/t/executing-custom-scripts-operations-in-postman-flows/38343)

<div class="topic-metadata">

**Author:** [@senglin](https://community.postman.com/u/senglin)\
**Replies:** 2\
**Last updated:** [October 21, 2025, 1:51pm UTC](https://community.postman.com/t/executing-custom-scripts-operations-in-postman-flows/38343 "2025-10-21T13:51:32Z")

</div>

Background: I have been using Postman Collection to automate extraction and parsing of body of API responses. This can be done via the Pre-request and Tests scripts that are executed before and after the Request is mad…

---

## [Can we get the common JS functions from GIT or from a network path to Postman pre/post script](https://community.postman.com/t/can-we-get-the-common-js-functions-from-git-or-from-a-network-path-to-postman-pre-post-script/85360)

<div class="topic-metadata">

**Author:** [@kdayalan](https://community.postman.com/u/kdayalan)\
**Replies:** 16\
**Last updated:** [October 9, 2025, 4:50pm UTC](https://community.postman.com/t/can-we-get-the-common-js-functions-from-git-or-from-a-network-path-to-postman-pre-post-script/85360 "2025-10-09T16:50:44Z")

</div>

Hi Is there a way to use the Common JS functions from a GIT repo or from a Network path within Postman pre request script/Post request script. Thank you Kavitha

---

## [Postman at TestBash Brighton 2025 🎉](https://community.postman.com/t/postman-at-testbash-brighton-2025/85311)

<div class="topic-metadata">

**Author:** [@gbadebo-bello](https://community.postman.com/u/gbadebo-bello)\
**Replies:** 1\
**Last updated:** [October 7, 2025, 9:17am UTC](https://community.postman.com/t/postman-at-testbash-brighton-2025/85311 "2025-10-07T09:17:51Z")

</div>

We had an incredible time with the Ministry of Testing Community at TestBash Brighton last week! With myself, @danny-dainton, and @marine-postman present in person. The testing community’s energy and enthusiasm were unma…

---

## [Collection Variable not updated from Post Request Script](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052)

<div class="topic-metadata">

**Author:** [@avionics-pilot-27400](https://community.postman.com/u/avionics-pilot-27400)\
**Replies:** 5\
**Last updated:** [September 25, 2025, 7:23pm UTC](https://community.postman.com/t/collection-variable-not-updated-from-post-request-script/85052 "2025-09-25T19:23:21Z")

</div>

Collection variable is not updating from my post request script: script: let decryptVerifier = eval(pm.globals.get("decryptVerifier"));let decryptedPayload = JSON.parse(decryptVerifier(JSON.stringify(pm.response.json()…

---

## [Creating an intentional delay in a loop inside a post-response script](https://community.postman.com/t/creating-an-intentional-delay-in-a-loop-inside-a-post-response-script/84592)

<div class="topic-metadata">

**Author:** [@geoangelmhdez](https://community.postman.com/u/geoangelmhdez)\
**Replies:** 1\
**Last updated:** [September 12, 2025, 10:50am UTC](https://community.postman.com/t/creating-an-intentional-delay-in-a-loop-inside-a-post-response-script/84592 "2025-09-12T10:50:49Z")

</div>

I am checking the status of a previous request in a post-response script. Is there any way that I can I set some delay if the previous step has not finished yet and I want to wait, let’s say, 5 seconds? This delay is set…

---

## [Setting Ocp-Apim-Subscription-Key in GraphQL client interface](https://community.postman.com/t/setting-ocp-apim-subscription-key-in-graphql-client-interface/83625)

<div class="topic-metadata">

**Author:** [@aidanwhitehall-dfs](https://community.postman.com/u/aidanwhitehall-dfs)\
**Replies:** 2\
**Last updated:** [August 16, 2025, 1:49pm UTC](https://community.postman.com/t/setting-ocp-apim-subscription-key-in-graphql-client-interface/83625 "2025-08-16T13:49:59Z")

</div>

Should it be possible to set the Ocp-Apim-Subscription-Key header in a Before query script in the GraphQL client interface? The short script below works fine as a pre-request script in a GraphQL query in an HTTP request…

---

## [Is it possible to write scripts for websocket connections?](https://community.postman.com/t/is-it-possible-to-write-scripts-for-websocket-connections/81812)

<div class="topic-metadata">

**Author:** [@security-participan1](https://community.postman.com/u/security-participan1)\
**Replies:** 1\
**Last updated:** [August 12, 2025, 2:01pm UTC](https://community.postman.com/t/is-it-possible-to-write-scripts-for-websocket-connections/81812 "2025-08-12T14:01:17Z")

</div>

The reason I need this because the data stream is compressed, and it would be really convenient to be able to decompress them and see the incoming data. For now I was not able to find anything that would help me to do t…

---

## [Error: Unexpected token ':'](https://community.postman.com/t/error-unexpected-token/80236)

<div class="topic-metadata">

**Author:** [@gopikrishna45951](https://community.postman.com/u/gopikrishna45951)\
**Replies:** 1\
**Last updated:** [May 21, 2025, 8:30am UTC](https://community.postman.com/t/error-unexpected-token/80236 "2025-05-21T08:30:08Z")

</div>

Hi I’m trying to execute an api which was forked from other workspace to mine. I was able to execute the api in shared workspace without any issue. i was unable to execute it in my personal workspace with the same envir…

---

## [Postman collection keeps running despite setNextRequest](https://community.postman.com/t/postman-collection-keeps-running-despite-setnextrequest/80286)

<div class="topic-metadata">

**Author:** [@keegs53](https://community.postman.com/u/keegs53)\
**Replies:** 4\
**Last updated:** [May 22, 2025, 12:50pm UTC](https://community.postman.com/t/postman-collection-keeps-running-despite-setnextrequest/80286 "2025-05-22T12:50:22Z")

</div>

I’ve been pouring through google and and the documenation for days but I can’t get this to work. This is my most simple example. In my Post-response block I have only these lines: console.log(“CALLING pm.execution.setN…

---

## [Raw CBOR payload with '//' chars are truncated on pre request script](https://community.postman.com/t/raw-cbor-payload-with-chars-are-truncated-on-pre-request-script/80165)

<div class="topic-metadata">

**Author:** [@krppsamy](https://community.postman.com/u/krppsamy)\
**Replies:** 11\
**Last updated:** [May 21, 2025, 9:11am UTC](https://community.postman.com/t/raw-cbor-payload-with-chars-are-truncated-on-pre-request-script/80165 "2025-05-21T09:11:21Z")

</div>

@danny-dainton @descent-module-engi4 I have a pre request script to send an api request to get some data on BE. this is POST request with raw cbor payload which contains ‘//’ special chars. While sending this payload …

---

## [Fixing crypto-js issues in Postman](https://community.postman.com/t/fixing-crypto-js-issues-in-postman/80202)

<div class="topic-metadata">

**Author:** [@docking-module-geo33](https://community.postman.com/u/docking-module-geo33)\
**Replies:** 3\
**Last updated:** [May 20, 2025, 8:43pm UTC](https://community.postman.com/t/fixing-crypto-js-issues-in-postman/80202 "2025-05-20T20:43:55Z")

</div>

I have a postman collection with a pre-request and post-request script. It had worked up until some time around the beginning of this year. We started getting the Cannot read properties of undefined (reading 'sigBytes')…

---

## [Replacing crypto-js with the global crypto object](https://community.postman.com/t/replacing-crypto-js-with-the-global-crypto-object/78377)

<div class="topic-metadata">

**Author:** [@jimjonah](https://community.postman.com/u/jimjonah)\
**Replies:** 6\
**Last updated:** [May 8, 2025, 2:18am UTC](https://community.postman.com/t/replacing-crypto-js-with-the-global-crypto-object/78377 "2025-05-08T02:18:15Z")

</div>

My pre-request script has this. var crypto = require('crypto-js'); I get this warning: Using “crypto-js” library is deprecated. Use global “crypto” object instead. How can I fix this?

---

## [Validating json with numeric keys in postman](https://community.postman.com/t/validating-json-with-numeric-keys-in-postman/29524)

<div class="topic-metadata">

**Author:** [@jorge.leon](https://community.postman.com/u/jorge.leon)\
**Replies:** 0\
**Last updated:** [November 9, 2021, 7:40am UTC](https://community.postman.com/t/validating-json-with-numeric-keys-in-postman/29524 "2021-11-09T07:40:00Z")

</div>

Hello people. My api returns the following json: { "code": 200, "status": "success", "data": { "threatChanges": { "229": { "1395": { "id": 1395, …

---

## [How to stop Collection Runner on error?](https://community.postman.com/t/how-to-stop-collection-runner-on-error/12647)

<div class="topic-metadata">

**Author:** [@michael.brooks](https://community.postman.com/u/michael.brooks)\
**Replies:** 16\
**Last updated:** [December 16, 2022, 10:26am UTC](https://community.postman.com/t/how-to-stop-collection-runner-on-error/12647 "2022-12-16T10:26:24Z")

</div>

I have a folder within a collection. I am using Collection Runner to run the queries within this folder. The second query uses data returned from the first. Therefore if the first query fails any of the tests in its test…

---

## [Postman update causing pm.sendRequest to require .catch() block — too many scripts to update](https://community.postman.com/t/postman-update-causing-pm-sendrequest-to-require-catch-block-too-many-scripts-to-update/79121)

<div class="topic-metadata">

**Author:** [@aerospace-technolog7](https://community.postman.com/u/aerospace-technolog7)\
**Replies:** 1\
**Last updated:** [April 24, 2025, 3:57am UTC](https://community.postman.com/t/postman-update-causing-pm-sendrequest-to-require-catch-block-too-many-scripts-to-update/79121 "2025-04-24T03:57:34Z")

</div>

Hi everyone, After a recent Postman update (I believe sometime around 04/23 2025), it seems that pm.sendRequest calls in my Pre-request Scripts are now throwing unhandled promise rejections unless they are wrapped in a .…

---

## [How to enable this textbox for JsonPath Expression input (in POSTMAN Tool) under "Visualize" tab?](https://community.postman.com/t/how-to-enable-this-textbox-for-jsonpath-expression-input-in-postman-tool-under-visualize-tab/15689)

<div class="topic-metadata">

**Author:** [@hcmehta9279](https://community.postman.com/u/hcmehta9279)\
**Replies:** 16\
**Last updated:** [April 16, 2025, 5:05pm UTC](https://community.postman.com/t/how-to-enable-this-textbox-for-jsonpath-expression-input-in-postman-tool-under-visualize-tab/15689 "2025-04-16T17:05:15Z")

</div>

How to enable this textbox for JsonPath Expression input (in POSTMAN Tool) under “Visualize” tab? I want to use JSONpath queries to filter data of Response Body in POSTMAN Tool.

---

## [Using pm.execution.setNextRequest to skip to the next folder instead of a request](https://community.postman.com/t/using-pm-execution-setnextrequest-to-skip-to-the-next-folder-instead-of-a-request/78557)

<div class="topic-metadata">

**Author:** [@annaboek](https://community.postman.com/u/annaboek)\
**Replies:** 3\
**Last updated:** [April 15, 2025, 2:01pm UTC](https://community.postman.com/t/using-pm-execution-setnextrequest-to-skip-to-the-next-folder-instead-of-a-request/78557 "2025-04-15T14:01:38Z")

</div>

While I’m on here thought I’d ask this question, I don’t think it’s possible. Is it possible to skip to the next folder name within a collection rather than the next request name using pm.execution.setnextrequest? Or i…

---

## [Postman API - Parameter is missing in the request](https://community.postman.com/t/postman-api-parameter-is-missing-in-the-request/4384)

<div class="topic-metadata">

**Author:** [@jdm.hexagon](https://community.postman.com/u/jdm.hexagon)\
**Replies:** 0\
**Last updated:** [March 7, 2019, 1:51am UTC](https://community.postman.com/t/postman-api-parameter-is-missing-in-the-request/4384 "2019-03-07T01:51:59Z")

</div>

I’m having trouble POSTing to the Postman API. I had this all working about a month ago, I’ve now returned to the project, but now I constantly get the error: { “error”: { “name”: “paramMissingError”, “message”: “Par…

---

## [Is there a easy way to define functions to use across multiple requests that is not the eval](https://community.postman.com/t/is-there-a-easy-way-to-define-functions-to-use-across-multiple-requests-that-is-not-the-eval/9272)

<div class="topic-metadata">

**Author:** [@cstmgl](https://community.postman.com/u/cstmgl)\
**Replies:** 1\
**Last updated:** [April 14, 2025, 3:53pm UTC](https://community.postman.com/t/is-there-a-easy-way-to-define-functions-to-use-across-multiple-requests-that-is-not-the-eval/9272 "2025-04-14T15:53:05Z")

</div>

hi all, I’m here to see if there is a better way of doing “How to reuse Postman scripts and tests among different test cases” without using the eval method? I want to do something like why described here: open to define…

---

## [Solving Third Party Library Issues In Postman](https://community.postman.com/t/solving-third-party-library-issues-in-postman/473)

<div class="topic-metadata">

**Author:** [@kjepsonVF](https://community.postman.com/u/kjepsonVF)\
**Replies:** 5\
**Last updated:** [April 14, 2025, 3:46pm UTC](https://community.postman.com/t/solving-third-party-library-issues-in-postman/473 "2025-04-14T15:46:31Z")

</div>

Hello Postman Community, I would like to see if anyone has a solution to an issue I am facing when trying to leverage 3rd party libraries. The proposed solution I have found in stack overflow and the postman bog and ot…

[Next page](https://community.postman.com/tag/scripts/27.md?match_all_tags=true&page=1&tags%5B%5D=scripts)
