# Generate custom taskId and ProcessInstanceId instead of flowable's id

**URL:** <https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037>\
**Category:** Flowable Engine\
**Created:** [November 6, 2020, 9:10am UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037 "2020-11-06T09:10:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joyal.joy777](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joyal.joy777/32/1791_2.png) [@joyal.joy777](https://forum.flowable.org/u/joyal.joy777)\
**Post date:** [November 6, 2020, 9:10am UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037/1 "2020-11-06T09:10:26Z")

</div>

Hi Guys,

I want to generate custom processInstanceId and TaksId for our workflows. Depending upon the deployed workflows, we keep custom prefix for each and assosciate custom uuid with it. Similarly we want to generate custom uuid for individual tasks also. Can you guys suggest the correct way to override it.

I have seen the question: [Can I generator Id (task or processInstance) by special rule?](https://forum.flowable.org/t/can-i-generator-id-task-or-processinstance-by-special-rule/2738/4). But I didn’t uderstood what are the steps for implementing custom **DbSqlSession**. How I can implement it’s custom implementation(like where I should tell my custom implemented class. Can I add it in **SpringProcessEngineConfiguration** like Delegates and event listeners?). What are steps need to make flowable understand about my custom implementation?

Thanks

---

<div class="post-metadata">

**Author:** ![joyal.joy777](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joyal.joy777/32/1791_2.png) [@joyal.joy777](https://forum.flowable.org/u/joyal.joy777)\
**Post date:** [November 9, 2020, 6:39am UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037/2 "2020-11-09T06:39:59Z")

</div>

Hi guys… Anybody have any idea?..@martin.grofcik @joram…

---

<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:** [November 9, 2020, 9:22am UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037/3 "2020-11-09T09:22:14Z")

</div>

No need to ping anyone here … this is an open source forum and @-ing someone won’t get you a response faster.

If you want custom ID’s, you need to set a custom IdGenerator implementation on your engine configuration. See [https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L3034](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L3034)

---

<div class="post-metadata">

**Author:** ![joyal.joy777](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joyal.joy777/32/1791_2.png) [@joyal.joy777](https://forum.flowable.org/u/joyal.joy777)\
**Post date:** [November 9, 2020, 9:57am UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037/4 "2020-11-09T09:57:07Z")

</div>

I am really sorry joram, for directly mentioning…  
I have figured that out(for generating id), but my current problem is that to follow different rules for generating processId and taskId. Even if I implement custom implementation for an IdGenerator, it is going to generate id for processInstance as well as taskId with a common implementation…right?

From the question previously mentioned, I understood that overriding **DbSqlSession.insert(Entity entity)** give me the flexibility to generate different kind of Id for process instance and task. But still I didn’t understood how we can set that in engine config?

Is there any other methods?

Thanks…

---

<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:** [November 16, 2020, 8:04pm UTC](https://forum.flowable.org/t/generate-custom-taskid-and-processinstanceid-instead-of-flowables-id/7037/5 "2020-11-16T20:04:52Z")

</div>

> [@joyal.joy777](#):
>
> Even if I implement custom implementation for an IdGenerator, it is going to generate id for processInstance as well as taskId with a common implementation…right?

That’s correct, the IdGenerator needs to generate ids only, but doesn’t know about the final entity.

> [@joyal.joy777](#):
>
> From the question previously mentioned, I understood that overriding **DbSqlSession.insert(Entity entity)** give me the flexibility to generate different kind of Id for process instance and task. But still I didn’t understood how we can set that in engine config?

You can do that by setting a customSessionFactory on the engine configuration, returning DbSqlSessionc.class to have your version ‘win’ over the default one.

> [@joyal.joy777](#):
>
> Is there any other methods?

None that I can think of right now. Having fully customised id’s is not something that’s requested often.
