Developing a new Workflow

The section below describes briefly, the process of developing a new workflow.


To develop a new workflow, following artifacts or objects need to be created / modified:

·         Workflow Categories

·         Workflow Templates

·         Workflow Query (Document)

·         Workflow Approvals and Tasks (Tasks are optional)

·         Enabling the workflows on the form

·         Workflow submission classes

Let us go through each of these artifacts one by one:


Create Workflow Categories:

A workflow category defines the module in which the workflow will be available. Modules are defined by the SysModule enum. You will be doing following here:

·         Create a new category in workflow categories node (AOT à Workflow à Workflow Categories)

·         Specify the name and module to which it belongs


Create Workflow Templates:

A workflow template brings all the different elements of the workflow together. Workflow configurations are created based on a template, and many configurations can be based on the same template. The template defines which actions are allowed and which are required.

You will be doing following here:

·         Create a new template in the workflow templates node (AOT à Workflow à Workflow Templates)

·         Specify a name and category to which it belongs


Next we create a work flow document.


Create Workflow Document:

A query defines what tables are used to determine that a workflow can be initiated. Here you will do the following

·         Create a new query (AOT à Queries)

·         Specify a name and Add required tables to the data source.

·         Create a new class extending from WorkFlowDocument class (AOT à Classes)

·         Override the method getQueryName and return the name of newly created query

·         Save the class

·         Once query and its supporting class is created, attach this to Workflow template (Specify it under the Document property of template)


Next step is to attach Approvals and / or Tasks


Create Workflow Approvals (or Tasks): An approval route may contain a number of outcomes. It may be approved, rejected, returned or a change may be requested (For task it will be complete, reject or request change). The Workflow Approval element determines which of these outcomes is allowed and what happens in the event of each outcome. Each outcome can trigger specific code by specifying a menu item for each item. Do the following to create an approval

·         Create a new approval object in the Approvals node. (AOT à Workflow à Approvals)

·         Specify a unique name for the approval

·         Specify the Document (The class created for query) in the Document property

·         Specify ParticipantProvider. Normally you specify WorkflowUserGroupParticipantProvider. But one can create their own participant providers similar to the standard one and use them

·         Specify DueDateProvider. Normally you specify WorkflowWorkCalendarDueDateProvider. But one can create their own participant providers similar to the standard one and use them

·         Specify HierarchyProvider. Normally you specify WorkflowLimitHierarchyProvider. But one can create their own participant providers similar to the standard one and use them

·         Set the DocumentMenuItem to form menu item where you want the workflow to appear (Example sales order etc.)

·         Approval Outcomes:

o   Use a standard class that acts as an engine for all approval outcomes

o   You are not required to do anything but set the workflow to applicable outcomes, therefore call the same class from different menu items. The menu items simply allow you to use two different labels. In more complex workflows it may be necessary to override or copy and modify this class rather than use it directly. Ex: If you have to set an outcome for Approved do the following:

1.       Create a new Action type menu item and specify a name to it

2.       Set ObjectType property to Class and Object property to WorkflowWorkItemActionManager

3.       Now get to Workflow à Approvals à <Approval you created> à Outcomes à Approve node and specify ActionMenuItem as new menuitem created before.

o   Repeat Step 2 for all the outcomes you need

o   If you do not need an outcome you can simply disable it by changing Enabled property to No

·         Once an approval (or task) is created, drag and drop this approval (or task) into the required workflow template


Enable workflow on a form:

Now that the workflow template is defined, you can specify which forms will use this template. Do the following:

·         Add a WorkflowState field (More can be added by CreatedBy, Time, Status etc.) to the required table

·         Then traverse to the required form and on the design node properties, Set property WorkFlowEnabled to Yes and Set the WorkFlowDataSource (Will be the table for which you created the above field).

·         If you want, you can override the method canSubmitToWorkflow on the form and specify conditions when user can submit the record to workflow


After enabling the workflow on class, create a class to submit the records to workflow


Create a Submit to Workflow class:

To submit a document to workflow, call standard code to prompt the user for a comment and to process the submission. (Look at purchReqWorkflow class for an example)

·         After creating the submit to workflow class, create a corresponding action menu item

·         Now traverse to the workflow template and specify this submit to workflow class menu item on the SubmitToWorkFlowMenuItem property

·         Once this is done you can then configure the workflow and test it. (You can refer the Workflows – Installation and Configuration document that I sent earlier for configuring the workflows)


This will give you a broad idea as to what needs to be done for creating a workflow.


See Also:

Workflows – Installation and Configuration


Workflows – Detailed Development


One thought on “Developing a new Workflow

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s