So I’m playing around with dates and I’m yet again encountering an issue that I’ve been trying to understand what causes it. As the title says, my issue is that I get an error that my variable is not defined:
var moment = require('moment');
pm.globals.set("timestampeeee", moment().toISOString());
console.log(timestampeeee)
So, the problem is that to my understanding is that it is defined as I can see it :
I think the issue here is that you are not specifying from which scope the timestampeee variable must be pulled from when logging it out.
If you’re writing it like this it implies that it is declared in the same Scripts sandbox (like moment for example) whereas you’ve assigned it to the global scope.
To print it out use pm.globals.get("timestampeeee") instead.