Help needed with "ReferenceError: 'xyz' is not defined"

Hello!

I was reading interesting and very helpful blog article by @danny-dainton related to moment.js and I have problem with my pre-request script.

What am I doing wrong here? Why “created_before” is not defined?

1 Like

You’re trying to log out local variables created_before / created_after but these are not defined.

As you’re creating environment variables, you would need to reference those by using:

console.log(pm.environment.get('created_before'))

Similar to how you are doing this on line 12 of the script.

1 Like

You’re right, now it works as it should be. :slight_smile:

Thank you for quick help and valuable blog post - it was VERY helpful and easy to understand. :clap: :slight_smile: :

1 Like