An instance of the Participant component represents a human participant in the system. Use the Participant component to get information about a participant, such their name, e-mail address, roles to which they are assigned, and so on. You can also use the Participant component to change or add properties for a participant.
You can associate any data with a particular participant by using the Participant.store*Property() set of methods. To retrieve previously stored data, use the Participant.retrieve*Property() set of methods.
This component is commonly used as the variable participant, which is predefined in every process. The value of this predefined variable represents the participant who is currently executing the activity task. When executing automatic tasks, this variable stores a dummy instance of Participant named AutomaticHandler.
If you set the attribute Participant.next, the Process Execution Engine assigns the current instance to the specified participant. This assignment takes effect when the instance arrives at the next activity in the process (after the instance completes the current activity). This assignment is subject to permission checks: if the participant specified in Participant.next is not assigned to the next activity's role -- or the next activity is not Interactive -- then the instance remains unassigned.
If attribute Participant.sticky is set to true, the Process Execution Engine will keep the current participant assigned to the current process instance throughout the execution of the process. This assignment takes places every time the process instance moves from activity to activity, and is subject to permission checks.
In the following example, the Participant component is used to retrieve the current participant's attributes:
display "Current Participant ID: " + participant.id +
"\n Name: " + participant.name +
"\n ID number: " + participant.idNumber +
"\nIs this an automatic participant: " + participant.automatic +
"\n Email: " + participant.email +
"\nIs this an enabled participant: " + participant.enabled +
"\n locale: " + participant.locale +
"\n Organization: " + participant.organization +
"\n Organizational Unit: " + participant.organizationalUnit +
"\nIs this participant present?: " + participant.present +
"\nIs this participant online?: " + participant.online +
"\nIs the participant sticky?: " + participant.sticky +
"\nIs this a valid participant?: " + participant.valid
This example shows how to get a reference to the current Participant without using the predefined variable participant.
When your code is in a Global or in a BPM Object method (and not in the regular Process method), you do not have access to the participant predefined variable. When this is the case, it is still possible to get a reference to the current participant by using the default instance of the Participant component, which you access with Participant (uppercase P):
// this works even on Globals: display "Current Participant ID: " + Participant.id
In the following example, the Participant component is used to retrieve the roles to which the participant is assigned:
for each r in participant.roles
do
display "Participant's Role: " + r.name
end
In the following example, the Participant component is used to assign the current process instance to participant Part2. The assignment takes place after the process instance moves to the next activity.
part2 = participant.find(name : "Part2") participant.next = part2 display "Next Participant: " + participant.next.id
In the following example, the Participant component is used to find a participant by e-mail address:
part1 = participant.findByEmail(email : "zzz@xx.com") display "This Participant was found for email " + part1.email + ": " + part1.id
In the following example, the Participant component is used to store application-specific attributes for a participant:
storePropertyFor part1
using application = "ExpenseReporting",
name = "rejected_count",
value = "1"
display "Part1's property 'rejected_count' set to: " +
retrievePropertyFor(part1, application : "ExpenseReporting", name : "rejected_count")