My question:
i have been trying to use functions in my collections pre-request script to create variables.
when i check for the variable inside the collections pre-request script its found,
howerver when i do the same afterwards its gone. i couldnt find it manually either.
i am quite new to postman, am i missing something here?
Details:
this is the script where i call the function from the collections pr script:
The issue here is that the pm.collectionVariables.get
pre-request script of the collection by default executes before every call within that collection. So Iโm struggling to see why you would need to encase this in a function and call that function within the test scriptโฆ (it would have already executed the collection pre-req by the time the test script runs).
If you remove the function and just run the code inside it works as you describedโฆ
hey @w4dd325 ,
my goal was to create a set of functions i could then use globally in that collection.
i dont want it to execute everything before every request.
this was more of an example.
is there some way to achieve that?