• Michael Intravartolo

How-to: Create a Workflow Template


With the release of NAV 2016 came the addition of Workflow. Workflow allow you to use workflows that connect business-process tasks performed by different users.

But as with many new things not all parts of the story are being told. The various resources will help you to create new workflows (functionally) and how to add new workflow events and responses (technically), but do not tell, for example, anything about creating new workflow templates. Clearly, with CRONUS we get a number of readily setup templates, but how do you create a new template? How to accomplish this (1) manually or (2) by code as part of your add-on?

Manually

Basically there is not much of a difference between a workflow template or a regular workflow as both types are stored in the same table (1501). The sole discriminating factor is the Template field. Turning it on changes a regular workflow into a workflow template, and vice versa. But...there is no way of getting this done through the user interface. No page to create, open and modified a workflow template. No page that allows to check mark the template field.

Check out the Workflow Template page.


You can view a template or create a new workflow based on an existing template. But...no way to create a new template.

Workaround

  1. Open the Workflows page (CRONUS International Ltd./Departments/Administration/Application Setup/Workflow/Workflows)

  2. Click New (or New Workflow from Template) to create a new workflow and add all events and responses needed, but prevent to enter specifics like conditions that would disqualify it being a template

  3. Click OK

So we have a new workflow on the verge of being transformed to a template which we do by running the workflow table (1501) from the Development Environment.


1. Change the Code field to have meaningful value (accept the Rename dialog) and

2. Check mark the Template field



Tip: make sure that the Description field also has a meaningful value as this is used to list a workflow template.

By Code

Workflow templates are created through codeunit 2 (Company-Initialize) calling the function InitWorkflow in codeunit 1502

(Workflow Setup):


InitWorkflow in turn calls the local function

InsertWorkflowTemplates, where I would typically hook in for my own workflow template:


Enough example functions available to write my own

InsertMyWorkflowTemplate function.

But...wait!

Do I need to write my code here? What about that other nice new feature Eventing, I mentioned above? Is there now Integration Event available in the InsertMyWorkflowTemplate function that I can subscribe to?

I mean, it has been provided in codeunit 1520 (Workflow Event Handling) and 1521 (Workflow Response Handling) to allow me, without any footprint in these 2 codeunits, to write my own codeunits to create new workflow events and responses. Hasn't this been done for workflow templates? Nope, I am sorry.

So I will need to put code in codeunit 1502 to get this done. Yep, no way around it for now.

But...I have asked MS to create an integration event OnInsertWorkflowTemplates in codeunit 1502 for this very reason.

#microsoftdynamicsnav2016

0 views
Contact Us

Solution Systems, Inc.

3201 Tollview Dr. 

Rolling Meadows, IL 60008

Office: 847-590-3000

Email: info@solsyst.com

Support: 224-345-2020

Support Email: support@solsyst.com

Connect With Us
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Chicago
  • Manufacturing Software | Illinois
  • Microsoft Business Podcast
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago
Join our Mailing List

© 2020 Solution Systems, Inc.