ACSCE-5X practice question 6 of 15

What are the variable’s scopes available for Activiti workflows?

Full set: 87 questions
Answer options
A: Process instance and task. Correct answer
B: Node and task.
C: Process instance and form.
D: Process instance and global.
Correct Answer:
A. Process instance and task.
Explanation

In Activiti, the workflow engine embedded in Alfresco ACS 5.x, variables have two primary scopes. The first is the 'process instance' scope, where variables are accessible throughout the entire lifecycle of that specific workflow instance, including all its tasks and execution paths. The second is the 'task' scope, where variables are local to a particular user task. Task-local variables are typically used for data that is only relevant to that specific step and are not propagated to the parent process instance upon task completion.

Why Incorrect

B. Node and task: "Node" is a generic term for any element in a process diagram (e.g., task, gateway). It is not a defined variable scope in Activiti; scope is tied to the process instance or a specific task.
C. Process instance and form: A form is a user interface component used to capture data and set variables. It is not a variable scope itself; the variables it sets are stored in either the task or process instance scope.
D. Process instance and global: The term "global" is ambiguous. While process instance variables are global within that instance, Activiti does not have a "global" scope that spans across multiple, independent process instances. The correct terms are process instance and task.

References

1. Activiti 5.x User Guide, Section 7.5. Variables: "Every process instance can have variables... A variable can also be local to a specific task. Such a variable is only accessible on that task and its lifecycle is bound to that task." This section explicitly defines the two scopes.

2. Alfresco Content Services 5.2 Documentation, Workflow API: The Java API for the TaskService clearly distinguishes between the two scopes with methods like setVariable(String taskId, String variableName, Object value) which sets a process-instance-scoped variable from a task context, and setVariableLocal(String taskId, String variableName, Object value) which sets a task-scoped variable.

3. Alfresco Content Services 5.2 Documentation, Server-side JavaScript API, Workflow objects: The documentation for the task object in the Workflow JavaScript API shows properties for both process-scoped variables (task.vars) and task-scoped variables (task.localVariables), reinforcing the two distinct scopes.

Scroll to Top