# pm.collectionVariables.set/get behaves differently in Postman app than in Newton/Postman CLI

**URL:** <https://community.postman.com/t/pm-collectionvariables-set-get-behaves-differently-in-postman-app-than-in-newton-postman-cli/80615>\
**Category:** Help Hub\
**Tags:** tests, variables, pre-request-script\
**Created:** [May 29, 2025, 7:50pm UTC](https://community.postman.com/t/pm-collectionvariables-set-get-behaves-differently-in-postman-app-than-in-newton-postman-cli/80615 "2025-05-29T19:50:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrielbergoc-oreons](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@gabrielbergoc-oreons](https://community.postman.com/u/gabrielbergoc-oreons)\
**Post date:** [May 29, 2025, 7:50pm UTC](https://community.postman.com/t/pm-collectionvariables-set-get-behaves-differently-in-postman-app-than-in-newton-postman-cli/80615/1 "2025-05-29T19:50:01Z")

</div>

Hi y’all

I have this in a post-response of a request:

```js
const metadata = pm.response.json()[0].metadata; // either `null` or a string
pm.collectionVariables.set('metadata', metadata)

```

I use this variable to conditionally skip the next request; I have this in its pre-request script:

```js
const metadata = pm.collectionVariables.get('metadata');

if (metadata === null) {
    console.warn('WARN: /seatmap execution skipped: metadata was null')
    pm.execution.skipRequest();
}

```

this works like a charm in the Postman app (windows 11), but when I tried the same collection with Newman, the second request was being executed.

After a little digging, I discovered that in the Postman app, the `metadata` variable was saved and then recovered as a `null` object, but in Newman (and Postman CLI) it was either saved or recovered as a `"null"` string!

I resolved this issue by comparing `metadata` with `"null"` instead, so it’s not a problem for me anymore, but it seems like a bug, so I wanted to report it.

@danny-dainton
