# Inherit Owner from Parent Process

**URL:** <https://forum.flowable.org/t/inherit-owner-from-parent-process/9536>\
**Category:** Flowable Engine\
**Created:** [July 15, 2022, 11:19am UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536 "2022-07-15T11:19:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://forum.flowable.org/u/ChrisM)\
**Post date:** [July 15, 2022, 11:19am UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536/1 "2022-07-15T11:19:56Z")

</div>

Hi  
Is it possible to automatically inherit the owner of a parent process to a child process which gets created via a call activity?

Currently, we do that manually by setting the owner of the process like this:

```auto
var newProcess = runtimeService.createProcessInstanceBuilder().processDefinitionId("processDefinitionId").start();
runtimeService.addUserIdentityLink(newProcess.getId(), "Alice", IdentityLinkType.OWNER);

```

and we use a `StartProcessInstanceInterceptor` where we pass the ownership in the method `afterStartSubProcessInstance()` to the child process. However, this approach does not work if the call activity is the first step of a process because in that case the subprocess is created (and the intercepter executed) before the `ProcessInstanceBuilder.start()` method returns and therefore we have not yet set the owner on the parent process.

---

<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:** [July 20, 2022, 9:31am UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536/2 "2022-07-20T09:31:51Z")

</div>

An alternative implementation would be to pass a (transient) variable to the start and use e.g. an execution listener on start to set the identity link in the same transaction.

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://forum.flowable.org/u/ChrisM)\
**Post date:** [July 21, 2022, 6:09am UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536/3 "2022-07-21T06:09:52Z")

</div>

Thanks @joram for your suggestion. This is a viable solution with minimum impact.

I was also thinking of contributing a pull request which allows to pass a `List<IdentityLinkInfo>` to the `ProcessInstanceBuilder`. It would forward the list and also route it through the `StartProcessInstanceBeforeContext` as it is done with the other inputs. The identity links would be added to the process instance right after the transient variables have been handle: [flowable-engine/ProcessInstanceHelper.java at 0104a8dc8712c175513efb80ad1f5311dcedc663 · flowable/flowable-engine · GitHub](https://github.com/flowable/flowable-engine/blob/0104a8dc8712c175513efb80ad1f5311dcedc663/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ProcessInstanceHelper.java#L243)  
Would you accept such a pull request or is it undesired to further extend the number of inputs?

---

<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:** [July 22, 2022, 4:31pm UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536/4 "2022-07-22T16:31:26Z")

</div>

Yes, that sounds like a good addition indeed. A PR in that area would be nice!

---

<div class="post-metadata">

**Author:** ![ChrisM](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@ChrisM](https://forum.flowable.org/u/ChrisM)\
**Post date:** [July 26, 2022, 4:45pm UTC](https://forum.flowable.org/t/inherit-owner-from-parent-process/9536/5 "2022-07-26T16:45:42Z")

</div>

I submitted a pull request which allows to directly pass identity links for the process start:

> <https://github.com/flowable/flowable-engine/pull/3407>
>
> \#### Check List:
> \* Unit tests: YES
> \* Documentation: NA
