# Set requestName dynamically

**URL:** <https://community.postman.com/t/set-requestname-dynamically/14126>\
**Category:** Help Hub\
**Created:** [July 14, 2020, 2:42pm UTC](https://community.postman.com/t/set-requestname-dynamically/14126 "2020-07-14T14:42:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejas.deshpande](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@tejas.deshpande](https://community.postman.com/u/tejas.deshpande)\
**Post date:** [July 14, 2020, 2:42pm UTC](https://community.postman.com/t/set-requestname-dynamically/14126/1 "2020-07-14T14:42:53Z")

</div>

How to dynamically set the name of a request appearing in the report?  
This value can be accessed using `pm.info.requestName`.  
I wish to update this value at runtime to create more meaningful reports either in combination with Data Variables or otherwise.

Any help is highly appreciated!

---

<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:** [July 15, 2020, 2:51pm UTC](https://community.postman.com/t/set-requestname-dynamically/14126/2 "2020-07-15T14:51:52Z")

</div>

Hey @tejas.deshpande

Welcome to the community! ⭐

Currently, there isn’t a way to programmatically set the Request Name in the app, that `pm.*` function would only `get` the name.

You mentioned reporting and data variables - Would you be able to expand on your current use case?

---

<div class="post-metadata">

**Author:** ![tejas.deshpande](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@tejas.deshpande](https://community.postman.com/u/tejas.deshpande)\
**Post date:** [July 16, 2020, 9:50am UTC](https://community.postman.com/t/set-requestname-dynamically/14126/3 "2020-07-16T09:50:50Z")

</div>

In the collection run, I wanted to programatically set the Request Name with the aid of scripting or data from external sources.

Similar BDD use case would be:  
const tests = [“Valid Login”, “Invalid Login”]

```
tests.forEach(function(testName) {
  describe($testName, function() {
    assetSomething...
  }
}

```

Output would be similar to but not exactly…

> ✓ Valid Login  
> ✓ assetSomething  
> ✓ Invalid Login  
> ✓ assetSomething

---

<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:** [July 16, 2020, 12:30pm UTC](https://community.postman.com/t/set-requestname-dynamically/14126/4 "2020-07-16T12:30:20Z")

</div>

Are you trying to change the request name or the Test name within the request?

---

<div class="post-metadata">

**Author:** ![tejas.deshpande](https://avatars.discourse-cdn.com/v4/letter/t/e0b2c6/32.png) [@tejas.deshpande](https://community.postman.com/u/tejas.deshpande)\
**Post date:** [July 17, 2020, 9:03am UTC](https://community.postman.com/t/set-requestname-dynamically/14126/5 "2020-07-17T09:03:54Z")

</div>

Issue is with modifying the Request Name. Test titles can already be updated dynamically since its defined in Javascript.

For reference: From the image below, I would like to update the Request Name **Get assignments** to **Get assignments - {{Current\_DateTime}}** at runtime.

P.S. This is just a reference and the modification of Request Name at runtime can be for any other form/reason as well based on criteria.

 ![](https://us1.discourse-cdn.com/getpostman/original/3X/9/3/939ddafbc0613b87a45faab2829244d7e23625ed.jpeg)

Hope this helps. 🙂

---

<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:** [July 17, 2020, 9:38am UTC](https://community.postman.com/t/set-requestname-dynamically/14126/6 "2020-07-17T09:38:01Z")

</div>

There isn’t a programmatic way of doing this in the app for the Request Name as you can’t add the variable syntax to the name but you could look at using [Newman](https://github.com/postmanlabs/newman) and creating a script to inject that into the JSON file before Collection is run or some other way of dynamically changing this.
