I am trying to generate a random number using {{$randomInt}} and writing this script in pre-request script to get and set the value in an environment
let rand_int = pm.variables.replaceIn('{{$randomInt}}')
pm.environment.set("rand_int", rand_int)
But I want to use {{$randomInt}} directly in the body and store the value directly in the environment from the request body. Is there any way to do it?
Suppose this is my request body. When I send the request I want to auto-set that random value in the environment.
{
"gårdsnummer": {{$randomInt}}
}