One of the major additions to NAV 2016 is Workflow. Both technical and functional more than interesting to take a deep-dive in as me and my friend Arend-Jan Kauffmann did to prepare a What's New in 2016 workshop. It makes use of the new platform feature Eventing (technical) and has been applied to replace the Document Approval feature (functional).
If you haven't been on this subject yet, come and visit or book our workshops or inform yourself using the various resources that have been popping up since October, like for example:
- What is new in Dynamics NAV 2016- Workflow
- How Do I: Create and use Workflow in Microsoft Dynamics NAV 2016 (¡Hola, Vanessa! 😉
Or the various documents on the Microsoft Dynamics Learning Portal.
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?
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 Templates page.
You can view a template or create a new workflow based on an existing template. But … no way to create a new template.
- Open the Workflows page (CRONUS International Ltd./Departments/Administration/Application Setup/Workflow/Workflows)
- 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
- 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.
- Change the Code field to have meaningful value (accept the Rename dialog) and
- 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.
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 no 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. Wanna be help on this? Go there and give your vote. Thanx!
Never really have been back on this topic I can now tell that a publisher is now provided.