How to pass dynamic json request body in postman
<p>I have a POST request where i need to pass some parameters dynamically since my code is checking for a duplicate entry. I tried writing a pre request script and then setting the global variables and tried to access it in my request. It is not working. PFB, the details</p>

<p>Pre-request Script</p>

<p>postman.setGlobalVariable("firstname", (text + parseInt(Math.random()*10000)).toString());
postman.setGlobalVariable("lastname", text + parseInt(Math.random()*10000));</p>

<p>Body</p>

<p>{
  "request": 
    {
        "firstName":"{{firstname}}",
        "middleName":"mani",
        "lastName":"{{lastname}}"
}
}</p>

<p>Here firstName is getting passed as {{firstname}} instead of random string.</p>