Starting a Process Instance

Starting a process instance involves "creating" an instance of a process template.

The way in which you create, or start, an instance of a process template depends on the trigger type of the start event in the process template definition, as follows:

  • "None" - A process with a start event with this trigger type can be directly started using the createProcessInstance operation. This section describes starting a process instance using the createProcessInstance method.
  • "Message" - A process with a start event with this trigger type can be started in the following ways:
    • If the process was "published as a business service", an instance of the process is started by starting the business service. For information see Starting a Business Service. This is a common way to start a process instance.
    • If the process was "published as a REST service", an instance of the process is started by using the REST API method startProcessIncomingReceiveTask. Note this method is not available in the SOAP nor the Java API.

The following diagram shows an example of how calls to the Process Services API can be used to start a process instance.

Starting a Process Instance

The following step-by-step descriptions correspond to the numbered steps in the illustration above. Note that the descriptions are from a web service operation point of view, and provide an example of performing the operations using the web service API (SOAP). (For an equivalent example using the Service Connector API (Java), see Starting a Process Instance—Service Connector API Example (Java).)

Procedure

  1. Find the available process templates.

    The listProcessTemplates operation can be used to list available process templates on the node. (You could also use the queryProcessTemplates or queryProcessTemplatesAlt operation to get a list of process templates.)

    The response from the listProcessTemplates operation provides module names, process name, and versions of the available process templates. These are needed when calling the createProcessInstance operation to start a process instance.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proc="http://www.tibco.com/bx/2009/management/processManagerType">
       <soapenv:Header/>
       <soapenv:Body>
          <proc:qualifiedProcessName>
             <proc:moduleName></proc:moduleName>
             <proc:processName></proc:processName>
             <proc:version></proc:version>
          </proc:qualifiedProcessName>
       </soapenv:Body>
    </soapenv:Envelope>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
          <basicProcessTemplates xmlns="http://www.tibco.com/bx/2009/management/processManagerType">
    <basicProcessTemplate>
                <processQName>
                   <moduleName>/SalesCallback/Process Packages/SalesCallback.xpdl</moduleName>
                   <processName>SalesCallbackProcess</processName>
                   <version>1.0.0.201106301052</version>
                </processQName>
                <description/>
             </basicProcessTemplate>
             <basicProcessTemplate>
                <processQName>
                   <moduleName>/Supply/Process Packages/Supply.xpdl</moduleName>
                   <processName>Supply</processName>
                   <version>1.0.0.201105061158</version>
                </processQName>
                <description/>
             </basicProcessTemplate>
                       .
                       .
                       .
          </basicProcessTemplates>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
  2. Get starter operations.

    Starter operations refer to start events of processes. To be able to directly start an instance of a process template, the start event of the process must have a trigger type of "None" (as opposed to a trigger type of "Message", which requires that the process be started by a business service).

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proc="http://www.tibco.com/bx/2009/management/processManagerType">
       <soapenv:Header/>
       <soapenv:Body>
          <proc:qualifiedProcessName>
                   <proc:moduleName>/Supply/Process Packages/Supply.xpdl</proc:moduleName>
                   <proc:processName>Supply</proc:processName>
                   <proc:version>1.0.0.201105061158</proc:version>
          </proc:qualifiedProcessName>
       </soapenv:Body>
    </soapenv:Envelope>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
          <starterOperations xmlns="http://www.tibco.com/bx/2009/management/processManagerType">
             <starterOperation>
                <processQName>
                   <moduleName>/Supply/Process Packages/Supply.xpdl</moduleName>
                   <processName>Supply</processName>
                   <version>1.0.0.201105061158</version>
                </processQName>
                <operation>StartEvent</operation>
             </starterOperation>
          </starterOperations>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
  3. If the process template for which you are starting an instance has "start parameters" (also known as "formal parameters"), which are used to pass data into the process instance being started, you should also call the getStarterOperationInfo operation to get the names of the available start parameters.
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proc="http://www.tibco.com/bx/2009/management/processManagerType">
       <soapenv:Header/>
       <soapenv:Body>
          <proc:starterOperation>
             <proc:processQName>
                   <proc:moduleName>/Supply/Process Packages/Supply.xpdl</proc:moduleName>
                   <proc:processName>Supply</proc:processName>
                   <proc:version>1.0.0.201105061158</proc:version>
             </proc:processQName>
             <proc:operation>StartEvent</proc:operation>
          </proc:starterOperation>
       </soapenv:Body>
    </soapenv:Envelope>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
          <operationInfo xmlns="http://www.tibco.com/bx/2009/management/processManagerType">
             <operationName>StartEvent</operationName>
             <parameters>
                <templateAttribute>
                   <name>CustomerID</name>
                   <type>java.lang.String</type>
                </templateAttribute>
             </parameters>
          </operationInfo>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
  4. Start the process instance.

    The createProcessInstance operation is used to start the process instance and pass in start parameters, if required.

    The operation returns the process ID of the instance that is started.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proc="http://www.tibco.com/bx/2009/management/processManagerType">
       <soapenv:Header/>
       <soapenv:Body>
          <proc:createProcessInstanceInput>
             <proc:processQName>
                <proc:moduleName>/Supply/Process Packages/Supply.xpdl</proc:moduleName>
                <proc:processName>Supply</proc:processName>
                <proc:version>1.0.0.201105061158</proc:version>
             </proc:processQName>
             <proc:operationName>StartEvent</proc:operationName>
             <proc:parameterMap>
                <!--Zero or more repetitions:-->
                <proc:parameter>
                   <proc:name>CustomerID</proc:name>
                   <proc:value>9987-345</proc:value>
                </proc:parameter>
             </proc:parameterMap>
          </proc:createProcessInstanceInput>
       </soapenv:Body>
    </soapenv:Envelope>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
          <proc:processID xmlns:proc="http://www.tibco.com/bx/2009/management/processManagerType">pvm:0a121b</proc:processID>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>