# processInstanceId generation before starting instance

**URL:** <https://forum.flowable.org/t/processinstanceid-generation-before-starting-instance/8193>\
**Category:** Flowable Engine\
**Created:** [August 1, 2021, 2:15pm UTC](https://forum.flowable.org/t/processinstanceid-generation-before-starting-instance/8193 "2021-08-01T14:15:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mykeul](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mykeul](https://forum.flowable.org/u/mykeul)\
**Post date:** [August 1, 2021, 2:15pm UTC](https://forum.flowable.org/t/processinstanceid-generation-before-starting-instance/8193/1 "2021-08-01T14:15:17Z")

</div>

Hi,  
I am using Flowable 6.6.0 and Spring Boot 2.3.9

I would like to leverage processInstanceId in order to query the runtimeService or the historyService to check if a flow has completed or not.  
My use case is as follow:

1. The client sends a document to a controller in my spring boot application.
2. The application gives back a unique id that identifies the process instance.
3. The client polls for completion using this id (preferably processInstanceId)

However I start the process programmatically in a controller through processInstanceBuilder.start() before sending the response to the client.  
Is there a way to generate an instanceId from within the controller and then passes this instanceID to the processInstanceBuilder?

Thanks for your help.

---

<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 2, 2021, 1:02pm UTC](https://forum.flowable.org/t/processinstanceid-generation-before-starting-instance/8193/2 "2021-08-02T13:02:27Z")

</div>

For this purpose, the businessKey concept was added. You can pass the business key on instance start and correlate through it later on.

---

<div class="post-metadata">

**Author:** ![mykeul](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mykeul](https://forum.flowable.org/u/mykeul)\
**Post date:** [August 2, 2021, 6:36pm UTC](https://forum.flowable.org/t/processinstanceid-generation-before-starting-instance/8193/3 "2021-08-02T18:36:50Z")

</div>

Thank you very much Joram. That’s what I was looking for.
