Fuego.Lib : Activity

An instance of the Activity component represents an activity in a process. Use the Activity component to get an activity's properties, such as role participants, runtime properties, process details, and so on.

The most common use of this component is as the variable activity, which is predefined in every process. The value of this predefined variable represents the activity in the process for which the current code is being executed.

Example 1: Getting a Current Activity's General Information

The following example obtains general information about the current activity that is being executed. The predefined instance variable activity is used:

loc = Fuego.Locale.locale 

logMessage "Name: " + activity.name + 
    "\nLabel: " + activity.label + 
    "\nDescription: " + activity.description + 
    "\nLabel in english: " + getLabel(activity, locale : loc) + 
    "\nDocumentation" + activity.documentation 

Example 2: Getting a Current Activity's Properties, Without Using the Predefined Variable activity

The following example obtains properties of the current activity.

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 activity predefined variable. When this is the case, it is still possible to get a reference to the current activity by using the default instance of the Activity component, which you access with Activity (uppercase 'A'):

logMessage "ACTIVITY: " + Activity.name + 
     "\nAutocomplete: " + Activity.autoComplete + 
     "\nAutomatic: " + Activity.automatic + 
     "\nLevel: " + Activity.level + 
     "\nSuspendable: " + Activity.suspendable + 
     "\nDoes User select transition: " + Activity.userSelectsTransition 

Example 3: Getting an Activity's Design Properties

The following example obtains design properties of the current activity:

logMessage "ACTIVITY: " + Activity.name + 
     "\nDoes the activity have multiple transitions?: " + Activity.hasMultipleTransitions + 
     "\nProcess: " + Activity.process.name + 
     "\nRole: " + Activity.role.name 

Example 4: Getting an Activity's Runtime Properties

The following example obtains runtime properties of the current activity:

logMessage "ACTIVITY: " + Activity.name + 
     "\nDeadline: " + Activity.deadline + 
     "\nDoes this activity have instances: " + Activity.hasItems + 
     "\nPrevious Activity: " + Activity.source 

Example 5: Getting the Participants Assigned to the Activity's Role

The following example obtains the participants who are assigned to the current activity's role:

logMessage "Activity: "+activity.name+" in role "+Activity.role.name
for each p in Activity.role.participants 
do 
     logMessage "Participant "+p.id+"("+p.name+")" 
end 

Example 6: Referring to an Activity Other than the Current One

The following example obtains the label and other properties of a different activity in the current process:

myActivityId = "exampleId"
myActivity = Activity(myActivityId)
logMessage "Activity: " + myActivity.label
logMessage "Is this activity automatic?: " + myActivity.automatic