Querying relationships between process instances by using JavaScript

You can get a list of the relationships that a process instance has by using JavaScript. You can also get a filtered list (by status) of the process instances that are related to the current process instance. For example, you can filter on all the active process instances that are related to the current process instance.

Getting a list of relationships

To get a list of all the relationships associated with the current process instance, complete the follwing steps:
  1. Decide whether you want to check the user's authorization.
  2. Get the list of relationships by using the getRelationships() method, which has the following signature:
    TWProcessInstance.getRelationships(checkAuthorization);
    checkAuthorization
    A Boolean value that the method uses to determine whether it should check the user's authorization. The default is false.

    The getRelationships() method returns a list of relationships that are associated with the process instance (BPMRelationship objects).

Getting a list of independently associated process instances

To get a list of all the process instances that are associated with the current process instance in independent relationships, complete the following steps:
  1. Decide whether you want to check the user's authorization.
  2. Decide whether you want to filter the list of process instances based on their runtime status.
  3. Get the list of process instances by using the getRelatedProcesses() method, which has the following signature:
    TWProcessInstance.getRelatedProcesses(checkAuthorization, statusFilter)
    checkAuthorization
    A Boolean value that the method uses to determine whether it should check the user's authorization. The default is false.
    statusFilter
    A list of strings that filters the results. Valid values are Active, Completed, Failed, Terminated, Did not Start, and Suspended.

    The getRelatedProcesses() method returns a list of TWProcessInstance objects.

Getting a dependent process instance

Only one instance, called the dependent instance, can depend on the current instance. The dependent instance cannot complete until the current instance completes. To get the instance that depends on the current instance, complete the following steps:
  1. Decide whether you want to check the user's authorization.
  2. Get the list of relationships by using the getDependentProcess() method, which has the following signature:
    TWProcessInstance.getDependentProcess(checkAuthorization)
    checkAuthorization
    A Boolean value that the method uses to determine whether it should check the user's authorization. The default is false.

    The getDependentProcess() method returns a TWProcessInstance object.

Getting a list of process instance dependencies

The current process instance can have a number of process instances called dependencies, that it depends on. The current instance cannot complete until all the dependencies are complete. Deleting the current process instance also deletes the dependencies. To get a list of process instances that the current instance depends on, complete the following steps:
  1. Decide whether you want to check the user's authorization.
  2. Decide whether you want to filter the list of process instances based on runtime status.
  3. Get the list of relationships by using the getDependedOnProcesses() method, which has the following signature:
    TWProcessInstance.getDependedOnProcesses(checkAuthorization, statusFilter)
    checkAuthorization
    A Boolean value that the method uses to determine whether it should check the user's authorization. The default is false.
    statusFilter
    A list of strings that filters the results. Valid values are Active, Completed, Failed, Terminated, Did not Start, and Suspended.

    The getDependedOnProcesses() method returns a list of TWProcessInstance objects.