Create Workflows

Prerequisites

If Workflow Composer is configured to connect directly to the database, Insert and Update permissions for the following database tables are required:

  • WorkflowDefinition
  • WorkflowDefinitionVersion

The permissions are required for the logged in user when using integrated security and for the login credentials (username and password) specified if installing via Installation Manager and integrated security is not used.

Also ensure that you have installed the Activities and Contracts packages applicable to your environment. For more information, see Package Manager.

Workflow Types

Workflow Composer can be used to create the following workflow types:

Sequence

  • Most common type of workflow.
  • Executes a set of child activities according to a single, defined ordering.

Flowchart

  • Typically used to implement non-sequential workflows but can be used for sequential workflows if no FlowDecision nodes are used. Flowchart components include:

    • FlowStep – models one step of execution in the flowchart (simply a wrapper around a standard activity).
    • FlowDecision – branches execution based on a Boolean condition, similar to If.
    • FlowSwitch – branches execution based on an exclusive switch, similar to Switch.

State Machine

  • Allows you to model your workflow in an event-driven manner.

  • Typically used for human workflow scenarios.

  • A state machine can be in one state at any particular time.

    • Initial State – represents the starting point of the state machine.
    • Final State – represents the completion of the state machine.
    • Transition – a directed relationship between two states which represents the response of the state machine to an occurrence of an event.
    • Transition Action – an activity executed when performing a transition.
    • Entry Action – an activity executed when entering the state.
    • Exit Action – an activity executed when exiting the state.
    • Trigger – a triggering activity that causes a transition to occur.
    • Condition – a constraint which must evaluate to true after the trigger occurs for the transition to complete.

    State machine workflow are used with Forms Builder. See help for Forms Builder 3.x.

Basic Workflow Example

In this example, we will create a workflow for a Saved event on the Person entity. The event occurs when the Save button is clicked on the Student Master form of Anthology Student. This workflow sets a value for a specific field whenever a Student record is saved.

  1. On your desktop, double-click Workflow desktop icon to start the Workflow application.

  2. Click New Event Workflow. The New Event Driven Workflow window is displayed.

  3. In the Entities area:

    1. Click right arrow next to Cmc.Nexus.Contracts.

    2. Click right arrow next to Cmc.Nexus.

    3. Click Person (Person).

  4. In the Events area, click Saved (SavedEvent).

  5. In the Name field, specify a Name for the workflow definition and click OK.

    New Event Driven Workflow

    The New Event Driven Workflow window is closed and the name of the workflow, PersonSaved in our example, is displayed at the top left of the Designer pane and in the Properties pane. The Sequence flow is displayed in the center of the Designer pane.

  6. In the Toolbox, under Control Flow, select the If activity and drag it into the sequence.

  7. In the Condition field, specify the following VB expression: entity.HasChanged()

    Refer to Helpful Hints to learn more about the purpose of this condition.

    If - Entity.HasChanged()

  8. In the Toolbox, under Primitives, select the Assign activity and drag it into the Then branch of the If condition.

  9. In the To field of the Assign activity, type entity..

    Note: When the period is entered, an IntelliSense completion list displays all properties that can be associated with the selected entity in the Anthology domain (). Icons indicate the property type, e.g.:

    Field icon Fields
    Function icon Methods
    Event icon Events

    VB Properties Helper

  10. In the value field of the Assign activity, enter a VB expression. Type entity. and select a property from the drop-down list. In our example, we want to use the Nickname property to assign the string "Gator" to the Nickname field.

    • When you define a VB expression in the workflow, click the ellipsis button in the Properties pane next to the field to which the expression applies. The Expression Editor window is displayed. This enables you to view each expression and also provides the drop-down lists for valid options.

    • While you are creating the expressions, the hosted compiler validates expressions. Errors are marked with Error icon in the Sequence and in the Expression Editor. Detailed information about the errors is displayed in the Error tab at the bottom of the Designer pane.

    Assign To with Expression Editor

  11. In the Toolbox, under Cmc.Nexus.Workflow, select the SavePerson activity and drag it into the sequence.

    SavePerson activity

  12. In the Properties pane of the SavePerson activity, type entity in the Person field.

    SavePerson

  13. Click Save in the File section of the Home tab to store the workflow definition in a local file system if you are not ready to publish it.

  14. Click Publish in the Server section of the Home tab to save the workflow definition in the SQL Server database and publish it to the server that runs the workflows.

    Note: The Windows Service NextGen Nexus Event Workflows handles the workflow events. The service must be running on platform that hosts the application.

  15. To verify the workflow, in Anthology Student, open a Student Master form. Edit the form to remove any data from the Nickname field.

  16. Click Save and verify that Gator is displayed in the Nickname field.