Update
As per the postman's official doc, using postman.*
or responseBody
are deprecated and were old instructions. So, make sure you are running the latest version of Postman (standalone or chrome extension).
However, if you still face issues with pm.*
, then proceed below for some help.
Previous
If anyone is using the Desktop version of Postman (in my case Mac's desktop version),
Then,
- use
responseBody
instead of pm.response.text()
- to set global variable
postman.setGlobalVariable()
instead of pm.environment.set()
Sample:
var jsonData = JSON.parse(responseBody);
postman.setGlobalVariable("studentId", jsonData.studentId);
You can use SNIPPETS
to auto-generate basic things like the above to avoid these errors.

My Postman version detail:
Postman for Chrome
Version 5.5.6
OS X / arm64
Chrome 108.0.0.0