Subprocess instance ownership
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2015 12:59 PM
Hi,
I'm running a process A with a call activity that refers a subprocess B, and I'm using Activiti v5.17.
I didn't understand why the process instance ownership of B is not the same of A, but instead is of the userid that executed the usertask (of A) that precedes the call activity.
There is a way to have as start user of B the same of A ?
Thanks,
Vincenzo
I'm running a process A with a call activity that refers a subprocess B, and I'm using Activiti v5.17.
I didn't understand why the process instance ownership of B is not the same of A, but instead is of the userid that executed the usertask (of A) that precedes the call activity.
There is a way to have as start user of B the same of A ?
Thanks,
Vincenzo
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 01:20 AM
Hi Vincenzo,
I see 2 ways:
Martin
I see 2 ways:
- change CallActivityBehavior
- pass start user as variable to the subprocess.
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 11:55 AM
Hi Martin,
thank you for your response.
The second way (that is the first one I tried) doesn't work as I expected, ie I'm passing to subprocess B the start user in a variable, that I checked it is properly valued in B. But in this way the subprocess B owner will not be the start user, and this user will not see subprocess B in "My instaces" view of Activiti Explorer.
On the other hand the first way you suggest solved my problem 🙂
For those interested, I modified CallActivityBehavior adding the following few lines of code before the subprocess instantiation:
<java>
…
String pid = execution.getProcessInstanceId();
HistoricProcessInstance hpi = Context
.getProcessEngineConfiguration()
.getHistoryService()
.createHistoricProcessInstanceQuery()
.processInstanceId(pid)
.singleResult();
if (hpi != null) {
execution
.getEngineServices()
.getIdentityService()
.setAuthenticatedUserId(hpi.getStartUserId());
}
PvmProcessInstance subProcessInstance = execution.createSubProcessInstance(processDefinition);
…
</java>
thank you for your response.
The second way (that is the first one I tried) doesn't work as I expected, ie I'm passing to subprocess B the start user in a variable, that I checked it is properly valued in B. But in this way the subprocess B owner will not be the start user, and this user will not see subprocess B in "My instaces" view of Activiti Explorer.
On the other hand the first way you suggest solved my problem 🙂
For those interested, I modified CallActivityBehavior adding the following few lines of code before the subprocess instantiation:
<java>
…
String pid = execution.getProcessInstanceId();
HistoricProcessInstance hpi = Context
.getProcessEngineConfiguration()
.getHistoryService()
.createHistoricProcessInstanceQuery()
.processInstanceId(pid)
.singleResult();
if (hpi != null) {
execution
.getEngineServices()
.getIdentityService()
.setAuthenticatedUserId(hpi.getStartUserId());
}
PvmProcessInstance subProcessInstance = execution.createSubProcessInstance(processDefinition);
…
</java>