dynamically set called element in reusable sub-process

250 views
Skip to first unread message

Marco Antelmi

unread,
Jun 12, 2017, 2:25:42 PM6/12/17
to jBPM Usage
Hi,
i'm trying to use the "reusable sub-process" activity in the workbench bpmn editor. I have defined two sub-process and I would dynamically set the "called element" parameter: the called sub-process depends on some main process inputs.
So, I set a variable in a script task (invoked before the  "reusable sub-process" activity), with the following code: "kcontext.setVariable("processId", "processX");".
In the "reusable sub-process" I set the "called element" parameter to #{processId} but it doesn't work (the engine couldn't resolve the expression #{processId}).
Is there a way to get the value of the variable "processId" in the "called element" parameter?

Thanks,
Marco

Maciej Swiderski

unread,
Jun 12, 2017, 3:12:18 PM6/12/17
to Marco Antelmi, jBPM Usage
it is certainly a supported feature. Can you share your bpmn2 xml file so we can inspect it?

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/1abc7327-36b0-4cad-a794-db5f62306c3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marco Antelmi

unread,
Jun 12, 2017, 3:41:06 PM6/12/17
to jBPM Usage, antelm...@gmail.com
Hi Maciej,
you can find the main process bpmn attached.
When i try to start the process i receive the following error: "Unexpected error encountered: [FinWf.GenericWorkflow:5 - call sub process:3] -- Could not find process #{processId}".

Thanks,
Marco
GenericWorkflow.bpmn2

Maciej Swiderski

unread,
Jun 13, 2017, 8:54:29 AM6/13/17
to Marco Antelmi, jBPM Usage
Marco,

the reason for this is that you didn’t declare process variable for processId. Once you do that it will work just fine, see snippet here(added two lines in blue to your process definition):

<bpmn2:itemDefinition id="_subXItem" structureRef="String" />
  <bpmn2:process id="FinWf.GenericWorkflow" drools:packageName="org.jbpm" drools:version="1.0" name="GenericWorkflow" isExecutable="true">
    <bpmn2:property id="processId" itemSubjectRef="_subXItem"/>

Maciej

For more options, visit https://groups.google.com/d/optout.
<GenericWorkflow.bpmn2>

Marco Antelmi

unread,
Jun 13, 2017, 2:08:21 PM6/13/17
to jBPM Usage
Hi Maciej,
it works now, thank you very much!

Marco

Reply all
Reply to author
Forward
0 new messages