Reader small image

You're reading from  Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition

Product typeBook
Published inMar 2020
PublisherPackt
ISBN-139781838643812
Edition2nd Edition
Right arrow
Author (1)
Simon Buxton
Simon Buxton
author image
Simon Buxton

Simon Buxton has worked with Dynamics 365 Finance and Supply Chain Management since its earliest incarnations, starting with the product in early 1999 when Dynamics 365 Finance and Supply Chain Management was known as Damgaard Axapta 1.5. Simon has been the technical lead on many highly challenging technical projects in countries all around the world. These projects included complex integrations with on-premises and external systems, ISV solutions, and many technically challenging customer solutions. Now working with Binary, he was part of a team that implemented the first Dynamics 365 Finance and Supply Chain Management implementation as part of the Community Technical Preview (CTP) program, which led to the close working relationship with Microsoft that made this book possible
Read more about Simon Buxton

Right arrow

Workflow Development

Workflows in Microsoft Dynamics 365 Finance and Supply Chain Management have two main types of elements – approvals and tasks – that act on a document. This is the center of the workflow and is where tasks are triggered based on what the user decides. By document, we mean a record with a form that maintains it. For example, a New customer creation workflow would be based on the customer table using the customer details form as the document.

The workflow designer can then use conditions based on fields and display methods on tables in order to decide what happens. This solves many requirements where a great deal of flexibility in the configuration is required, but can also be misunderstood and used inappropriately. The submission of a workflow is usually started with the user pressing the Submit button on the form; it's which is then processed...

Creating a workflow type

A workflow type can be considered as a template or a document definition. It acts like an umbrella for associated workflow elements, such as approvals and tasks. When the designer starts to design a workflow, they actually select a workflow type, and the design surface will allow them to select workflow elements associated with it.

We create the workflow type first because the workflow type creation tooling will create elements that can be used in other workflow elements. We just come back to this in order to add them to the list of supported types by the workflow type.

Be careful when naming items as this process automatically creates menu items and classes. They are all prefixed with the workflow type's name. If we have a class that exists already, it will add a 1 to the name, which is unpleasant. For this reason, the maximum length is 20 characters...

Creating a workflow approval

A workflow approval is an element that can route the to a person or persons who can approve, reject, or request a change, or delegate an approval task. When the workflow is designed, we can use the outcome of an approval task to trigger other workflow tasks, or simply inform the user. The workflow approval status is persisted as a field on the document record (the vehicle record, in our case) in the same way that the workflow type does.

As a result of this, there are often two fields on the workflow's main table, one for the workflow document state, and another for the workflow element state. In some cases, such as human resource workflows, the Base Enum is combined into one field. This can seem confusing, but when the workflow status field is properly defined, it simplifies this process.

...

Creating a manual workflow task

A manual task is a task that is assigned to a user in order to perform an action. This action can be any task, such as Inspect vehicle, and the user will then state that the task was complete.

This workflow will be used to instruct the vehicle to be inspected and record whether it was inspected in a new field on the vehicle table.

Getting ready

This recipe is a continuation of the Creating a workflow type recipe as we need a workflow document class.

How to do it...

To create the manual workflow task, follow these steps:

  1. We need a new Base...

Hooking up a workflow to the user interface

This is the final step in designing our workflow and involves setting a property on the form that's referenced by the document menu item, ConVMSVehicleTable, and adding the option to design workflows to the menu.

Getting ready

For this recipe, all we need is a workflow type.

How to do it...

To be able to design and process workflows, follow these steps:

  1. Expand User interface, Menu items, and Display from the Application Explorer. Locate WorkflowConfgurationBasic, right-click on it, and choose Duplicate in project.
  2. Locate...

Creating a sample workflow design

Let's test the elements we have created. The following workflow design is only intended to test the workflow we have created and omits many features that we would normally use. We will also use the same user for submission and approval, and you will see them appear to be waiting for the workflow engine as we test. This seems like a problem at first glance, but in real-life scenarios this is fine. In practice, tasks and approvals are performed by different users and are not done as a series of tasks. They will receive a notification so that they can perform that action and pass the ball back to the workflow engine.

Getting ready

Before we start, ensure that the package is built and synchronized...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition
Published in: Mar 2020Publisher: PacktISBN-13: 9781838643812
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Simon Buxton

Simon Buxton has worked with Dynamics 365 Finance and Supply Chain Management since its earliest incarnations, starting with the product in early 1999 when Dynamics 365 Finance and Supply Chain Management was known as Damgaard Axapta 1.5. Simon has been the technical lead on many highly challenging technical projects in countries all around the world. These projects included complex integrations with on-premises and external systems, ISV solutions, and many technically challenging customer solutions. Now working with Binary, he was part of a team that implemented the first Dynamics 365 Finance and Supply Chain Management implementation as part of the Community Technical Preview (CTP) program, which led to the close working relationship with Microsoft that made this book possible
Read more about Simon Buxton