IRuntimeService API: C# Sample Code

1. Create Process Instance2. Get the specific Process Instance3. Force to complete the specific Process Instance4. Get the variable of the Process Instance 

Example: 

1. Create Process Instance

  1.          ' Create the new variable lists.
  2.          Dim variables As New Dictionary(Of String, Object)()
  3.          variables.Add("Test Variable", "Testing....")
  4.          ' Create a new Process Instance by IProcessDefinition object. 
  5.          Dim instance As IProcessInstance = runtimeService.CreateProcessInstance(processDefinition)
  6.          ' Create a new Process Instance by process Definition ID.
  7.          instance = runtimeService.CreateProcessInstance(processDefinitionId)
  8.          ' Create a new Process Instance by IProcessDefinition object and the variable lists.
  9.          instance = runtimeService.CreateProcessInstance(processDefinition, variables)
  10.        ' Create a new Process Instance by process Definition ID and the variable lists.
  11.        instance = runtimeService.CreateProcessInstance(processDefinitionId, variables)

2. Get the specific Process Instance

  1.         ' instance id Get the specific process instance by process instance id.
  2.         instance = runtimeService.GetProcessInstance(instanceId)

3. Force to complete the specific Process Instance

  1.         ' Force to complete the specific process instance
  2.         runtimeService.CompleteProcessInstance(instance)

4. Get the variable of the Process Instance 

  1.         ' Get process variable by runtimeService
  2.         variables = runtimeService.GetVariables(instanceId)
  3.         ' Get the specific process variable by runtimeService
  4.         Dim variable As Object = runtimeService.GetVaraible(instanceId, "Test Variable")
  5.         ' Get process variable by process Instance
  6.         variables = instance.GetVaraibles()
  7.         ' Get the specific process variable by process Instance
  8.         variable = instance.GetVaraible("Test Variable")

Last edited Jun 13, 2012 at 6:55 AM by cathysung, version 6

Comments

No comments yet.