Menu Close
Settings Close

Language and Page Formatting Options

Chapter 4. BPMN2 tasks in process designer

A task is an automatic activity that is defined in the process model and the smallest unit of work in a process flow. The following task types defined in the BPMN2 specification are available in the Red Hat Process Automation Manager process designer palette:

  • Business rule task
  • Script task
  • User task
  • Service task
  • None task

Table 4.1. Task

Business rule task

bpmn business rule task

Script task

bpmn script task

User task

bpmn user task

Service task

bpmn service task

None task

bpmn none task

In addition, the BPMN2 specification provides the ability to create custom tasks. The following predefined custom tasks are included with Red Hat Process Automation Manager:

  • Rest service tasks: Used to invoke a remote RESTful service
  • Email service tasks: Used to send an email
  • Log service tasks: Used to log a message
  • Java service tasks: Used to call Java code
  • WebService service tasks: Used to invoke a remote WebService call
  • DecisionTask tasks: Used to execute a DMN diagram

Business rule task

A business rule task defines a way to make a decision either through a DMN model or a rule flow group.

bpmn business rule task

When a process reaches a business rule task defined by a DMN model, the process engine executes the DMN model decision with the inputs provided.

When a process reaches a business rule task defined by a rule flow group, the process engine begins executing the rules in the defined rule flow group. When there are no more active rules in the rule flow group, the execution continues to the next element. During the rule flow group execution, new activations belonging to the active rule flow group can be added to the agenda because these activations are changed by other rules.

Script task

A script task represents a script to be executed during the process execution.

bpmn script task

The associated script can access process variables and global variables. Review the following list before using a script task:

  • Avoid low-level implementation details in the process. A script task can be used to manipulate variables, but consider using a service task when modelling more complex operations.
  • Ensure that the script is executed immediately, otherwise use an asynchronous service task.
  • Avoid contacting external services through a script task. Use a service task to model communication with an external service.
  • Ensure scripts do not throw exceptions. Runtime exceptions should be caught and managed, for example, inside the script or transformed into signals or errors that can then be handled inside the process.

When a script task is reached during execution, the script is executed and the outgoing flow is taken.

User task

User tasks are tasks in the process workflow that cannot be performed automatically by the system and therefore require the intervention of a human user, the actor.

bpmn user task

On execution, the User task element is instantiated as a task that appears in the list of tasks of one or more actors. If a User task element defines the Groups attribute, it is displayed in task lists of all users that are members of the group. Any user who is a member of the group can claim the task.

After it is claimed, the task disappears from the task list of the other users.

User tasks are implemented as domain-specific tasks and serve as a base for custom tasks.

Service task

Service tasks are tasks that do not require human interaction. They are completed automatically by an external software service.

bpmn service task

None task

None tasks are completed on activation. This is a conceptual model only. A none task is never actually executed by an IT system.

bpmn none task

4.1. Creating a business process in Business Central

The process designer is the Red Hat Process Automation Manager process modeler. The output of the modeler is a BPMN 2.0 process definition file. The definition is used as input for the Red Hat Process Automation Manager process engine, which creates a process instance based on the definition.

The procedures in this section provide a general overview of how to create a simple business process. For a more detailed business process example, see Getting started with business processes.

Prerequisites

Procedure

  1. In Business Central, go to MenuDesignProjects.
  2. Click the project name to open the project’s asset list.
  3. Click Add Asset → Business Process.
  4. In the Create new Business Process wizard, enter the following values:

    • Business Process: New business process name
    • Package: Package location for your new business process, for example com.myspace.myProject
  5. Click Ok to open the process designer.
  6. In the upper-right corner, click the Diagram properties diagram properties icon and add your business process property information, such as process data and variables:

    1. Scroll down and expand Process Data.
    2. Click btn plus next to Process Variables and define the process variables that you want to use in your business process.
  7. In the process designer canvas, use the left toolbar to drag and drop BPMN components to define your business process logic, connections, events, tasks, or other elements.
  8. After you add and define all components of the business process, click Save to save the completed business process.

4.2. Creating business rules tasks

Business rules tasks are used to make decisions through a Decision Model and Notation (DMN) model or rule flow group.

Procedure

  1. Create a business process.
  2. In the process designer, select the Activities tool from the tool palette.
  3. Select Business Rule.
  4. Click a blank area of the process designer canvas.
  5. If necessary, in the upper-right corner of the screen, click the Properties icon.
  6. Add or define the task information listed in the following table as required.

    Table 4.2. Business rule task parameters

    LabelDescription

    Name

    The name of the business rule task.

    Rule Language

    The output language for the task. Select Decision Model and Notation (DMN) or Drools (DRL).

    Rule Flow Group

    The rule flow group associated with this business task. Select a rule flow group from the list or specify a new rule flow group.

    On Entry Action

    A Java, JavaScript, or MVEL script that specifies an action at the start of the task.

    On Exit Action

    A Java, JavaScript, or MVEL script that specifies an action at the end of the task.

    Is Async

    Select if this task should be invoked asynchronously. Make tasks asynchronous if they cannot be executed instantaneously, for example a task performed by an outside service.

    Adhoc Autostart

    Select if this is an ad hoc task that should be started automatically. Adhoc Autostart enables the task to automatically start when the process or case instance is created instead of being starting by a start task. It is often used in case management.

    SLA Due Date

    The date that the service level agreement (SLA) expires.

    Assignments

    Click to add local variables.

  7. Click Save.

4.3. Creating script tasks

Script tasks are used to execute a piece of code written in Java, JavaScript, or MVEL. They contain code snippets that specify the action of the script task. You can include global and process variables in your scripts.

You can write action scripts in Java, JavaScript, and MVEL. Note that MVEL accepts any valid Java code and additionally provides support for nested access of parameters. For example, the MVEL equivalent of the Java call person.getName() is person.name. MVEL also provides other improvements over Java and MVEL expressions are generally more convenient for business users.

Procedure

  1. Create a business process.
  2. In the process designer, select the Activities tool from the tool palette.
  3. Select Script.
  4. Click a blank area of the process designer canvas.
  5. If necessary, in the upper-right corner of the screen, click the Properties icon.
  6. Add or define the task information listed in the following table as required.

    Table 4.3. Script task parameters

    LabelDescription

    Name

    The name of the business rule task.

    Documentation

    Enter a description of the task. The text in this field is included in the process documentation. Click the Documentation tab in the upper-left side of the process designer canvas to view the process documentation.

    Script

    Enter a script in Java, JavaScript, or MVEL to be excuted by the task, and select the script type.

    Is Async

    Select if this task should be invoked asynchronously. Make tasks asynchronous if they cannot be executed instantaneously, for example a task performed by an outside service.

    Adhoc Autostart

    Select if this is an ad hoc task that should be started automatically. Adhoc Autostart enables the task to automatically start when the process or case instance is created instead of being starting by a start task. It is often used in case management.

  7. Click Save.

4.4. Creating user tasks

User tasks are used to include human actions as input to the business process.

Procedure

  1. Create a business process.
  2. In the process designer, select the Activities tool from the tool palette.
  3. Select User.
  4. . Either drag and drop a business rule onto the process designer canvas or click a blank area of the canvas.
  5. If necessary, in the upper-right corner of the screen, click the Properties icon.
  6. Add or define the task information listed in the following table as required.

    Table 4.4. User task parameters

    LabelDescription

    Name

    The display name of the business rule task.

    Documentation

    Enter a description of the task. The text in this field is included in the process documentation. Click the Documentation tab in the upper-left side of the process designer canvas to view the process documentation.

    Task Name

    The name of the human task.

    Subject

    Enter a subject for the task.

    Actors

    The actors responsible for executing the human task. Click Add to add a row then select an actor from the list or click New to add a new actor.

    Groups

    The groups responsible for executing the human task. Click Add to add a row then select a group from the list or click New to add a new group.

    Assignments

    Local variables for this task. Click to open the Task Data I/O window then add data inputs and outputs as required.

    Reassignments

    Specify a different actor to complete this task.

    Notifications

    Click to specify notifications associated with the task.

    Is Async

    Select if this task should be invoked asynchronously. Make tasks asynchronous if they cannot be executed instantaneously, for example a task performed by an outside service.

    Skippable

    Select if this task is not mandatory.

    Priority

    Specify a priority for the task.

    Description

    Enter a description for the human task.

    Created By

    The user that created this task.

    Adhoc Autostart

    Select if this is an ad hoc task that should be started automatically. Adhoc Autostart enables the task to automatically start when the process or case instance is created instead of being starting by a start task. It is often used in case management.

    Multiple Instance

    Select if this task has multiple instances.

    On Entry Action

    A Java, JavaScript, or MVEL script that specifies an action at the start of the task.

    On Exit Action

    A Java, JavaScript, or MVEL script that specifies an action at the end of the task.

    Content

    The content of the script.

    SLA Due Date

    The date the the service level agreement (SLA) expires.

  7. Click Save.

4.5. Creating service tasks

A service task is a task that is part of the process that is executed outside of the process, but is not a human task. Examples of service tasks include sending an email and logging a message when these tasks are performed by systems. You can define the parameters (input) and results (output) that are associated with a service task. A Service Task should have one incoming connection and one outgoing connection.

Procedure

  1. Create a business process.
  2. In the process designer, select the Activities tool from the tool palette.
  3. Select Service Task.
  4. Click a blank area of the process designer canvas.
  5. If necessary, in the upper-right corner of the screen, click the Properties icon.
  6. Add or define the task information listed in the following table as required.

    Table 4.5. Service task parameters

    LabelDescription

    Name

    The name of the service task.

    Documentation

    Enter a description of the task. The text in this field is included in the process documentation. Click the Documentation tab in the upper-left side of the process designer canvas to view the process documentation.

    Implementation

    Specify whether the task is implemented in Java or is a web service

    Interface

    The class used to implement the script, for example org.xyz.HelloWorld.

    Operation

    The method that will be called by the interface, for example sayHello().

    Assignments

    Click to add local variables.

    Adhoc Autostart

    Select if this is an ad hoc task that should be started automatically. Adhoc Autostart enables the task to automatically start when the process or case instance is created instead of being starting by a start task. It is often used in case management.

    Is Async

    Select if this task should be invoked asynchronously. Make tasks asynchronous if they cannot be executed instantaneously, for example a task performed by an outside service.

    Is Multiple Instance

    Select if this task has multiple instances.

    On Entry Action

    A Java, JavaScript, or MVEL script that specifies an action at the start of the task.

    On Exit Action

    A Java, JavaScript, or MVEL script that specifies an action at the end of the task.

    SLA Due Date

    The date the the service level agreement (SLA) expires.

  7. Click Save.

4.6. Making a copy of a business process

You can make a copy of a business process in Business Central and modify the copied process as needed.

Procedure

  1. In the business process designer, click Copy in the upper-right toolbar.
  2. In the Make a Copy window, enter a new name for the copied business process, select the target package, and optionally add a comment.
  3. Click Make a Copy.
  4. Modify the copied business process as needed and click Save to save the updated business process.

4.7. Resizing elements and using the zoom function to view business processes

You can resize individual elements in a business process and zoom in or out to modify the view of your business process.

Procedure

  1. In the business process designer, select the element and click the red dot in the lower-right corner of the element.
  2. Drag the red dot to resize the element.

    Figure 4.1. Resize an element

    Resizing an element
  3. To zoom in or out to view the entire diagram, click the plus or minus sign on the lower-right side of the canvas.

    Figure 4.2. Enlarge or shrink a business process

    Zooming to view the entire diagram

4.8. Generating process documentation in Business Central

In the process designer in Business Central, you can view and print a report of the process definition. The process documentation summarizes the components, data, and visual flow of the process in a format (PDF) that you can print and share more easily.

Procedure

  1. In Business Central, navigate to a project that contains a business process and select the process.
  2. In the process designer, click the Documentation tab to view the summary of the process file, and click Print in the top-right corner of the window to print the PDF report.

    Figure 4.3. Generate process documentation

    Project-level service task settings