"Using "globals" is deprecated. Use "pm.globals" instead"


At the end of March I started noticing that I get the following error message when triggering collections via webhook and then try to access the payload that I sent to the webhook via
So I sent a request and a payload to
and then try to access that payload with:

var json = JSON.parse(globals.previousRequest).data;

In the log I see this error message:
Using “globals” is deprecated. Use “pm.globals” instead

I googled and searched in this forum, but strangely couldn’t find anyone discussing this.

I already tried replacing globals with pm.globals but then I get this error message:
JSONError: Unexpected token u in JSON at position 0

Hey @vegconomist :wave:

Welcome to the Postman Community! :postman:

There have been some changes made to the sandbox and the pm.* set of APIs in there.

You can convert this to now use:

var json = JSON.parse(pm.globals.get("previousRequest")).data;

Let me know if this works and removes that warning. :pray:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.