Starting a new process
A new instance of a process can be started by using the
tw.system.startProcessByName()
function.
Parameters
The methodtw.system.startProcessByName()
returns
a TWProcessInstance
object and takes 2 parameters:- name (String)
- Name of the process.
- inputValues (Map)
- Map containing the input parameters for the process.
var inputs = new tw.object.Map();
inputs.put("parm1", "parm1 value");
inputs.put("parm2", "parm2 value");
tw.system.startProcessByName("StartProcess2", inputs);
Thread hung exceptions
Under certain circumstances,
an attempt to start a process instance using the
tw.system.startProcessByName()
function
might be blocked, and in the system out log you might see a thread
hung exception for a thread holding a database connection. This might
happen in the following circumstance: - You have defined an undercover agent (UCA) message event with an attached service.
- In the attached service you are starting a new process instance
using the
tw.system.startProcessByName()
function. - The process you are starting has variables defined that are exposed to Business Data Search, and the process creation hangs.
The recommended solution is to use the BPMN (Business Process Model and Notation) best practice, and model the process with a start message event. The UCA message event will then be attached to this start message event.