# Using dynamic variable values in tests?

**URL:** <https://community.postman.com/t/using-dynamic-variable-values-in-tests/959>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [February 16, 2018, 8:13pm UTC](https://community.postman.com/t/using-dynamic-variable-values-in-tests/959 "2018-02-16T20:13:46Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![tmccann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/tmccann/32/3550_2.png) [@tmccann](https://community.postman.com/u/tmccann)\
**Post date:** [May 17, 2018, 10:43pm UTC](https://community.postman.com/t/using-dynamic-variable-values-in-tests/959/21 "2018-05-17T22:43:40Z")

</div>

@ed_truqc Thats awesome. The great thing about Postman is its very flexible in what it can do when it comes to working with creating data.

I am more than happy to help any way I can. If you run into any problems, feel free to reach out to me at any time.

---

<div class="post-metadata">

**Author:** ![luckvery](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/luckvery/32/16153_2.png) [@luckvery](https://community.postman.com/u/luckvery)\
**Post date:** [June 21, 2023, 12:23pm UTC](https://community.postman.com/t/using-dynamic-variable-values-in-tests/959/22 "2023-06-21T12:23:41Z")

</div>

Postman added `update` to allow us to more elegantly [update the request body](https://stackoverflow.com/a/73634536/1008162) in a pre-request-script.

There are many ways to do it but for me I created a place holder `pre-request-created` to replace a uuid that I generate.

```auto
const body = pm.request.body.raw.replace("{{pre-request-created}}", uuid);
pm.request.body.update({
    mode: 'raw',
    raw: body
});

```

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 2, 2023, 3:22pm UTC](https://community.postman.com/t/using-dynamic-variable-values-in-tests/959/23 "2023-08-02T15:22:06Z")

</div>

Closed on August 2, 2023, 3:22pm UTC



[Previous page](https://community.postman.com/t/using-dynamic-variable-values-in-tests/959.md?page=1)
