cancel
Showing results for 
Search instead for 
Did you mean: 

New process instance in some Activity

marcosdutto
Champ in-the-making
Champ in-the-making
Is there anyway to start a process in a particular Activiti, and not in the start Node?

For example I have this definition:

Start -> UTask1 -> UTask2 -> End

And i want to start the instance in the UTask2.

I tried with

ProcessDefinitionEntity pd = (ProcessDefinitionEntity) ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(pdId);
ExecutionEntity pi3 = pd.createProcessInstance(null, ActivitiUTask2);

but i received

Exception in thread "main" java.lang.NullPointerException
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.insert(ExecutionEntity.java:1032)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.newProcessInstance(ProcessDefinitionEntity.java:146)
   at org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl.createProcessInstanceForInitial(ProcessDefinitionImpl.java:59)
   at org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl.createProcessInstance(ProcessDefinitionImpl.java:49)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.createProcessInstance(ProcessDefinitionEntity.java:76)
   at gecos.main.main(main.java:200)

Thanks in advance.

Marcos Dutto
2 REPLIES 2

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Sure, just put an exclusive gateway in front of the UTask1, with one outgoing flow to UTask2 and start te process  by passing a param tat you check in te gateway…

frederikherema1
Star Contributor
Star Contributor
Starting a process should be done using the API, not by using the ProcessDefinitionEntity directly, this is activiti-internal stuff… Maybe a call-activity is what you are looking for?

http://activiti.org/userguide/index.html#bpmnCallActivity