Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Pre-Request Script scopes in Postman

I have collection named "Auth" with pre-request script where I define JavaScript variable "token", and some JavaScript general functions, which I want to use in my inner pre-request scripts.

Within "Auth" collection I have folder name "Tests" with own pre-request script. I expected both scripts to be merged but when I try to use "token" JavaScript variable from "Auth" collection I get an error:

ReferenceError: currentAccessToken is not defined

How to access JavaScript variables (and JavaScript functions) from collection pre-request script in inner folder pre-request script?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Postman has different variable scopes, which you would need to use, eg:

pm.globals.set("variable_key", "variable_value");
pm.globals.get("variable_key");

pm.collectionVariables.set("variable_key", "variable_value");
pm.collectionVariables.get("variable_key");

pm.environment.set("variable_key", "variable_value");
pm.environment.get("variable_key");

Please check out Using variables for more details.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!