Process Instance Attributes and Methods

This section summarizes the attributes and methods that are available for accessing information about process instances using the Process class.

Attribute/Method Example Description
priority : Integer priority = Process. priority; Returns priority of the Process Instance
getName() : String name = Process.getName(); Returns Process Template name
getDescription() : String description = Process. getDescription(); Returns description of Process
getStartTime() : Datetimetz start = Process. getStartTime(); Returns date/time the Process Instance was started
getPriority() : Integer priority = Process. getPriority(); Returns priority of the Process Instance
getOriginator() : String originator = Process. getOriginator(); Returns originator of Process Instance, e.g. uid=admin, ou=system
getId() : String id = Process. getId(); Returns Process Instance ID, for example, pvm:0a128cu
getActivityLoopIndex() : Integer index = Process. getActivityLoopIndex()
  • Retrieves the most local loop index.
  • Index starts from 0 (zero) for first loop/multi-instance instance.
  • In a parallel loop/multi-instance task or embedded sub-process, all loop instances run concurrently. To pass the loop index of a particular loop instance to a task:
    • Use the input mapping functionality if this is available.
    • If it is not, use a local data field.
    • Use a process-level data field only as a last resort. Each loop instance will try to set the field with the index of that particular loop instance; but the field is common to all loop instances in the process and can only contain a single value. A task can successfully get and set the index in the same transaction, but if there is any delay in getting the index the field may have been overwritten by another instance.
  • For a non-multi-instance task, this will be the loop index for the nearest multi-instance embedded sub-process ancestor (defaulting to 0 if no multi-instance ancestor found).
  • In nested multi-instance situations, the user can transfer an embedded sub-process loop index into a embedded sub-process local data field.
addActivityLoopAdditionalInstances: (String, Integer) add = Process.addActivityLoopAdditionalInstances ("UserTask",1) Adds additional instances to a multi-instance loop task while that task is in progress
getActivityType(String) : String type = Process.getActivityType('UserTask2'); Returns task type, for example, userTask
getActivityState(String) : String state = Process.getActivityState('UserTask2'); Returns task state, for example, done.state
getActivityStartTime(String) : Datetimetz started = Process.getActivityStartTime('UserTask2'); Returns time task was started
getActivityCompletionTime(String) : Datetimetz completed = Process.
getActivityCompletionTime('UserTask2'); Returns time task was completed
getActivityDeadline(String) : Datetimetz deadtime = Process.getActivityDeadline('UserTask2'); Returns task deadline time
getActivityAttribute(String, String) : String workItemId = Process.getActivityAttribute('UserTask2','WorkItemId');

completer = Process.getActivityAttribute('UserTask2','Completer');

Returns value of attribute, for example, 430

Only WorkItemId and Completer are supported as attribute names.

getActivityArrayAttribute(String, String) : List<String> attrs = Process.getActivityArrayAttribute('UserTask2','Participant'); Returns array of attribute values. Only Participant is supported as an attribute name.**
setPriority() : Integer priority = Process.setPriority(); Once a process instance has been created, it can change its own priority.

The default value is 200. Valid entries are 100, 200, 300 and 400.

getOriginatorName(): String name = Process.getOriginatorName() Returns the process instance originator login name. For use with a pageflow or business process.
setContextVariable (String varName, BusinessObject data) contextVariable = Process.setContextVariable (cargoType, steel); For use with pageflow processes. Enables a BDS context variable to be created as an attribute on the main process. These context variables can be accessed by the main process or any of its sub-processes.

For a pageflow process, there is only one thread of execution so a single script can access a context variable in a thread-safe manner. These methods are not intended for use in a business process.

getContextVariable (String varName, String className) contextVariable = Process.getContextVariable (cargoType, "className"); For use with pageflow processes. Gets a BDS context variable created as in the previous method.
auditLog (String message) Process.auditLog ("Unknown Cargo Type " + cargoType.name) ;

Adds a simple text entry to the audit log (process-instance related event log entry).

Use of the Process.auditLog() method is not supported for in-memory process instances (service processes, pageflow processes or business services). If the Process.auditLog() method is used on one of these processes (whether started from within a parent business process or independently), no audit entries will be generated.