# How to Modify the name of a process instance in runtime?

**URL:** <https://forum.flowable.org/t/how-to-modify-the-name-of-a-process-instance-in-runtime/808>\
**Category:** Flowable Engine\
**Created:** [August 2, 2017, 9:44am UTC](https://forum.flowable.org/t/how-to-modify-the-name-of-a-process-instance-in-runtime/808 "2017-08-02T09:44:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gperetto](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@gperetto](https://forum.flowable.org/u/gperetto)\
**Post date:** [August 2, 2017, 9:44am UTC](https://forum.flowable.org/t/how-to-modify-the-name-of-a-process-instance-in-runtime/808/1 "2017-08-02T09:44:31Z")

</div>

To modify the name of an instance of the process in runtime, I used the following code in a script task.  
Is it the right way? Is there a better alternative?

var idProcessInstance = execution.getProcessInstanceId();  
runtimeService.setProcessInstanceName(idProcessInstance, ‘Name…’);

Thank!

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [August 4, 2017, 7:34am UTC](https://forum.flowable.org/t/how-to-modify-the-name-of-a-process-instance-in-runtime/808/2 "2017-08-04T07:34:42Z")

</div>

That’s fine, going through the runtimeService in a script will reuse the the current command context and doesn’t start a new transaction.

---

<div class="post-metadata">

**Author:** ![gperetto](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@gperetto](https://forum.flowable.org/u/gperetto)\
**Post date:** [August 4, 2017, 12:44pm UTC](https://forum.flowable.org/t/how-to-modify-the-name-of-a-process-instance-in-runtime/808/3 "2017-08-04T12:44:49Z")

</div>

Thanks Joram for the answer  
Gastón
