cancel
Showing results for 
Search instead for 
Did you mean: 

How to create Multi instance User Task without using XML

surindersingh
Champ in-the-making
Champ in-the-making
I have created user task which i can assign to multiple user at a time using XML
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcessmulti" name="NEW MULTIPROCESS INSTANCE" isExecutable="true">
    <startEvent id="startevent1" name="Start">
    <extensionElements>
            <activiti:formProperty id="decisionInfo" name="Decision info" required="true" type="string" />
            <activiti:formProperty id="participants" name="Participants (comma separated)" required="true" type="string" />
         </extensionElements>
    </startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:class="com.poc.multiinstance.CreateAssigneeList"></serviceTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <userTask id="usertask1" name="User Task" activiti:assignee="${assignee}">
      <multiInstanceLoopCharacteristics isSequential="false">
       <loopDataInputRef>assigneeList</loopDataInputRef>
      <inputDataItem name="assignee"/>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="usertask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow3" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
  </process>


Can i done this in activiti without using XML file ?. And how can i use the MultiInstanceActivityBehavior.class file to assign the task manually to multiple user at time?.


I would appreciate your help. Thank You.
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
You didn't post your xml correctly.

Why do you want to do this without xml?
The MultiInstanceActivityBehavior can only be used in the context of a process, not standalone.

surindersingh
Champ in-the-making
Champ in-the-making
Hello Jbarrez,

Sorry for incorrect xml .
I uploaded  xml file please find the attachment.


currently i am creating the workflow using XML files . Bt as per client requirement i want to create dynamically.

Now i am crearting workflow dynamically using simple table driven definitions.
So is there a way to create multinstance tasks like this.? Bt i do not want to use xml
and want to create multinstance tasks.

jbarrez
Star Contributor
Star Contributor
Activiti does not support  adding dynamically new tasks to it, nor creating them up front without xml im afraid.

The only thing that Activiti supports is creating 'standalone' tasks through the taskService, but they are not related to process instances directly as regular tasks are.

surindersingh
Champ in-the-making
Champ in-the-making
Hello Jbarrez,

I am createing the workflow dynamically .

but i dont want to create workflow using static xml file.

so my question is i want to create dynamically XML file with  multinstance tasks instance.
so how to create it.

please help me to create dynamically xml files.

Thank you.

martin_grofcik
Confirmed Champ
Confirmed Champ
Could describe your usecase?

Regards
Martin

jbarrez
Star Contributor
Star Contributor

surindersingh
Champ in-the-making
Champ in-the-making
Hello Jbarrez,

Thanks.

I wan't to that using simple table driven definitions but again the table driven definitions has very limited set of classes so i have decide to use bpmn modeler classes as specified in your refrrence link.


In Dynamic Process Creation:- how can i create the one  task for multiple user ??

Thanks.

martin_grofcik
Confirmed Champ
Confirmed Champ
how can i create the one task for multiple user ??
You could assign task to user's group (e.g. candidateGroups attribute in task).

Regards
Martin

surindersingh
Champ in-the-making
Champ in-the-making
Hi Martin,

Thanks for help to implement the Multi-Instance user task assignment using group wise.