I'm trying to send a POST request to create a user using Postman. Require dynamic user email and password for that.
I'm trying assign value in new variable return from Postman inbuilt variable $randomEmail
in Pre-request Script
-
var new_user_email = $randomEmail;
var new_user_password = $randomPassword;
console.log(new_user_email);
console.log(new_user_password);
pm.globals.set("new_user_email", "new_user_email");
pm.globals.set("new_user_password", "new_user_password");
But it throws exception ReferenceError: $randomEmail is not defined
while if i use directly in request body like below, it works fine
{
"email": "{{$randomEmail}}",
"password": "{{$randomPassword}}"
}
Any idea about syntax to use it in pre-request script and store for further use ?