Creating a Sample Scripted Workflow

The simplest way to learn how to create execution engine plans is to work through an example.


This guide takes you through steps for creating an execution engine plan and a simple example of workflow.

Execution Plan Screen Tour

  1. Select Launchpad > Modeller > Workflow and Forms > Execution Engine.
  2. Click the Plan Browser button at the top of the screen.
  3. The plan editor opens.
  4. Before continuing, familiarise yourself with the various screens. 
    Screen Area Description
    Meta Data

    The meta data area of the plan allows you to configure the high level information about the plan such as the plan name.

    Ensure that you make these as descriptive as possible.

    Steps

    The steps area allows you to configure each step in your plan. When the screen opens, a main entry point step is created by default.

    Script

    The script area allows you to enter the details for your plan. Although plans are written using a JavaScript-like language, you do not need to be a developer to use them. Instead, use the provided snippets and examples.

    Snippets

    Snippets are available to paste into your plan using the snippet editor at the bottom of the page.

Create a Simple Plan

Step Description
Create Plan Create a Simple Execution Engine Plan
Get the work-type id from the event data

When you trigger a plan, event object (ev) carries data about the event, such as the related Sharedo ID. It is useful to have this data stored for the lifetime of the plan. You can do this by placing the data into a context object.

How to Get Work-type ID from an Event

Get a list of any participants you need for the plan

When your plan is triggered from a work-type, you can enrich the data you have from the event with other information. For example, the holder of a specific role on the work-type. You can choose to do this at the start of your plan in the 'main' function (which is the first step that is executed.)

This example gets a list of the participants with the creator role and gets the ID of the first record (note there should only be one creator role). You could also use this enrichment later in a plan to get holders of a role that may not be static. For example, roles that change over the life of the work-type.

How to Get Work-type ID from an Event

Adding a new step to a plan

Once you have set up the basic information that you want to store from the original event, you can start to create the steps in your plan.

In our sample, the first step creates a simple task. This section talks about the steps for adding new steps on a plan. The following sample details how to create a simple task as part of a step.

Create an Execution Engine Step

Create a task within an EE plan step

Now that you've declared a new step and your function is created, declared, and called, you can begin to make the step perform some actions. In the sample, you create a simple task with some action plan items.

(Note that this smart plan is available as a snippet in the snippet manager if you wish to follow along.)

Create a Task with Action Plan Items

Create an End Step

Add a new step called endProcess. This step is the step that closes your process.

Create an Final Execution Engine Step

Link Plan to a trigger

To test your plan, you must link the execution engine plan to a trigger. If you are following the sample plan, link it to a phase change event on a work-type where you have access (for example, a service request).

Create an Execution Engine Trigger

Test your Plan

Trigger the event that causes your plan to execute (such as a phase change on a service request).

If your plan works: You should see a task created against your service request - this is visible from the actions navigation bar.

If your plan fails: Go to the execution engine diagnostics tool for more information.

Monitoring an Execution Engine Plan