9.2 Adding Activities to a Workflow

Activities are the building blocks of your workflow. Each activity has a predefined purpose in the workflow. Workflow Builder provides you multiple activities to choose from to build custom workflows.

While creating a new workflow diagram, you must always start with a Start activity and end the workflow with a Finish activity, then connect both these activities together with a flow path. You can insert an activity between two activities by dropping it onto the flow path.

The following procedure shows you how to add a Start activity and Finish activity to an existing workflow. It assumes that only the basic parameters have been defined for this workflow.

  1. In the Workflow Administration Console, go to Catalog > Workflow and select the workflow to which you want to add the activities. The workflow opens in the Workflow Builder tab.

  2. Drag the Create Start Activity icon from the palette and place it in the canvas at desired location.

    Set the properties of this activity (see Setting the General Properties of an Activity). For detailed information about configuring the Start activity, see Section 10.0, Workflow Activity Reference.

  3. To add a Finish activity, drag the Create Finish Activity icon from the palette and place it in the canvas below the Start activity.

    Next add a forward flow path in between the two activities. For more information, see Adding Flow Paths.

9.2.1 Setting the General Properties of an Activity

The name and identifier are common to all activities. Workflow Builder auto-generates an identifier in the <Activity>_<N> format, where <Activity> represents the name of an activity and <N> represents an alphanumeric value consisting of 7 characters. It is unique and non-editable for each activity.

An activity has a common name that you can change. We recommend that you replace the common name of an activity with a descriptive string that describes the specific purpose of that activity in the workflow. This makes it easier to understand the workflow when you look at the workflow diagram.

You can either set the properties of an activity just after adding it to a workflow diagram, or later select that activity on canvas and define its properties. If any required property is found empty, the Errors and Warnings banner on the canvas will turn red, indicating the number of errors and warnings in that workflow. To know more about these errors, click the Problems tab located below the canvas.

9.2.2 Defining the Data Items for an Activity

You can use the Data Items tab to map data from the data flow into the fields in a form (pre-activity mapping) and to map data from the form back to the data flow (post-activity mapping).

To define data items for an activity:

  1. On the canvas, click the activity icon for which you want to set data items.

    You can also view the Data Items tab by simply dragging the window located below the palette. Data Item tab is selected by default.

  2. For pre-activity mapping, click in the Source Expression field for the item that you want to map, then specify an expression.

    Pre-activity maps can be used for:

    • Initializing form control values.

    • Setting default values for form controls.

    • Populating complex form controls with data lists derived from LDAP queries.

    • Passing data from form controls of a previous activity to a form control in the current activity.

    • Calling external Java classes to process data.

    Leave the Source Expression blank in pre-activity maps for form fields that the user is expected to fill in. Alternatively, create a source expression to supply a default value for form fields that the user is expected to fill in. In either case the form field needs to be defined as editable while creating the form in Form Builder. See Administrator’s Guide to the Form Builder for information about setting the properties of form fields.

  3. For post-activity mapping, go to the Post Activity tab and click in the Target Expression field for the item that you want to map, then specify an expression. You can use the MAP ALL button to automatically generate the target expression for all source form fields.

    Post-activity maps can be used for:

    • Creating new data items in flowdata.

    • Moving form control data from an activity into flowdata.

    • Calling external Java classes to process data.

For detailed information about data item mapping for the different types of activities, see Section 10.0, Workflow Activity Reference.

The Start Activity can have hard-coded strings, system variables like process locale and recipient, and Identity Vault expressions (created using the ECMA Script Builder Modal window) in pre-activity maps.

9.2.3 Defining the Email Template Settings

You can use the Email Template tab to select an email template, and to specify expressions to provide values for named parameters included in the email template. Emails are sent when a new Approval activity starts (to notify approvers that they have work to do) and when the Finish activity completes (to notify the initiator that the workflow is done).

To define the email template settings:

  1. On the canvas, click the activity icon for which you want to configure the email template settings.

  2. Go to the Email Template tab, select an email template from a list of defined templates.

    Localized email templates: By default, the Email Template tab displays email notification templates that are in default language. When you select a template from the list, the email is in the user’s default language (if the default is a supported language). So, while notifying a user, the Workflow Engine sends the email in the user’s default language using the selected notification template. If the selected template is not available in required language, the Workflow Engine sends the email in the default language.

    Editing an email template: You can edit an email template from the Notification Templates page in the Workflow Administration Console. For more information, see Editing a Notification Template.

  3. Click the Source field for a Target token and specify an ECMAScript expression that assigns a value to the token.

    See Section 10.0, Workflow Activity Reference for information about email notification settings.

9.2.4 Validating a Workflow

Validating a workflow is an important step in creating a workflow, even though it does not guarantee that every process will be completed successfully. Validation helps to limit the possibility for errors during the deployment.

While you are creating a workflow, you must follow guidelines for adding activities and connecting them. Workflow Builder performs a set of predefined validation check on the workflow. Any violation, if detected, is displayed in the Problems tab with an error or warning message against an ID. You can click the ID to locate the activity on the canvas and resolve the reported errors and warnings before publishing.

A workflow can display a validation error even though it showed 0 errors and 0 warnings in the banner. At the time of publishing, Workflow Engine checks the workflow on the server and displays a validation failure message if your workflow violates the guidelines of workflow creation. For more information, see Guidelines for Creating Workflows.

Workflow Administration Console also uses XML Schema Definition (XSD) to validate the workflow XML. This schema document contains a set of rules to which a workflow XML document must conform to be considered valid according to that schema. These additional validations help reduce potential issues that might develop when deploying a workflow. The XSD validation is enabled by default.