I need to use the same value into two different elements/attributes on the one XML request body. I tried to add it as a collectionVariable and recall it from there but Postman generates two different values for them.
For example, I am trying to generate $randomEmail dynamic variable and use it in two request body elements:
<Email>{{$randomEmail}}</Email>
<ConfirmEmail>{{$randomEmail}}</ConfirmEmail>
When I check the sent request then I can see that Postman actually sent different values for mentioned elements like:
<Email>test1@email.com</Email>
<ConfirmEmail>test2@email.com</ConfirmEmail>
Do you have any idea how to define one specific value per each request and use it on several body elements/attributes?
store the value in a variable using prerequest script:
pm.variables.set("email",pm.variables.replaceIn("{{$randomEmail}}") )
now in the body use it like :
<Email>{{email}}</Email>
<ConfirmEmail>{{email}}</ConfirmEmail>