Workflows in Dynamics NAV 2016 enable you to model your day to day business processes in the system. It provides three main capabilities: approvals, notifications and process automation.

NAV 2016 demo database ships with several pre-defined workflow templates that utilises these capabilities for standard functionality. You can use these templates as is or copy and adjust them before using them for your organisation’s need. Off course you can create completely new workflow templates if none of these fit your needs.

Workflows in NAV are implemented as events and responses with the intention that you can mix and match different events and responses to build new workflows.

Workflow event is a trigger for the workflow to start. It can be a NAV event or action implemented in C/AL and registered in workflow library. A response is an implementation in C/AL as a response.

Before we look at these workflows in action, let’s look at some required setups for workflows.

SMTP Setup

If we expect workflow notifications to be sent through emails, we need to define SMTP server settings in NAV. SMTP setup in NAV is pretty straight forward.  Once setup, use the Test Email Setup button to make sure that NAV can connect and send emails through the SMTP server.

Microsoft NAV 2016 workflows im1

Job Queue

We will need a Job Queue so the actions can run in the background. We can utilize the default job queue for this purpose. Make sure the default job queue has been started. If not, use the “Start Job Queue” button on the job queue card to start the job queue.

Microsoft NAV 2016 workflows im2

Approval User Setup

Because our workflow would use the NAV approval process, make sure you have the approval user setup defined for everyone involved in the approval process. Mainly you define the change of approvals here. To see the emailing functionality in action, fill in the email addresses for all users involved.

Microsoft NAV 2016 workflows im3

Workflow User Groups

Workflow user groups is where you create groups of users for approvals. Later on we will be able to use these groups in our conditions and filters for different workflow responses related to approval. The sequence number define the order for approvals. Same sequence for two users mean approval requests are sent at the same time rather than one after the other.

Microsoft NAV 2016 workflows im4

Notification Setup

In NAV we have pre-defined notification templates but we can create our own template too. For our purpose we will use the approval template and schedule it to send instantly. NAV gives you an option setup schedule for these notifications so for example you can set them up to be sent once every day by selecting ‘Daily’ recurrence.

Microsoft NAV 2016 workflows im5

Customer Approval Workflow

Now that we have our setups in place let’s look at our first example.

We want to introduce an approval process for customer credit limit changes if the limit exceeds a certain value.

We will start by creating a new workflow. You can do this by going to Departments -> Administrations -> Application Setup -> Workflow -> Workflows

Choose New Workflow from Template and chose Sales and Marketing -> Customer Approval Workflow

Microsoft NAV 2016 workflows im6

You will be presented with the window showing workflow steps based on the template that we can modify as per our needs.

Microsoft NAV 2016 workflows im7

Say in our example we require an approval if the credit limit is more than $10,000.

During the approval process we want the customer to be blocked so no documents are posted for that customer.

The first step is to define the filter for approval trigger. On the first line where it says (View Filter Details) click on the assist edit button and you will see filtering options for the customer records, for our example set the credit limit filter to <10,000.

Microsoft NAV 2016 workflows im8

Say when the approvals have been made, you want to send a notification to the user in addition to remove the restriction on the customer record.

To achieve this on the line with condition Pending Approval:0 click on the assist edit button, click on add responses and click on Add More Responses.

Create a new line and choose Create a notification for %1. In the section below choose the Recipient User ID.

Microsoft NAV 2016 workflows im9

The next step is to choose the workflow user group instead of the default behaviour which is direct approvers.

To do this click the assist edit button on the first line under the Then Response column.

Then for the Create an approval request, line change the approver type to Workflow User Group and choose our group below that.

Microsoft NAV 2016 workflows im10

That’s it. The only thing that remains to be done is to enable this workflow. You do this by checking the enable checkbox on the workflow card.

Now let’s see this workflow in action.

Go to a customer card and change the credit limit to a value greater than 10,000 and press the Send Approval Request on the ribbon. This will initialize the approval process and will end notification emails and also create notification records on NAV.

You can also look at the workflow progress by click in the active workflow from the workflow fact box.

Microsoft NAV 2016 workflows im11

Note: this action will restrict this customer, so if you try to post an invoice for this customer you will see an error saying a restriction is imposed by the approval workflow.

Now if you look at the Approval Request Entries you will see that there are two entries waiting for the users to approve.

Microsoft NAV 2016 workflows im12

Notification are also created for the users:

Microsoft NAV 2016 workflows im13

Once these users login and approve their respective entries. The customer credit limit will be applied and the restriction on customer will be taken off. A notification to the user ‘Dan’ will also be sent as per our setup.

Purchase Invoice Workflow

Let’s look at a different example of a workflow where we automate the posting of a purchase invoice through a workflow.

This time select the template Purchase Invoice Workflow under Purchase Documents for the workflow.

Microsoft NAV 2016 workflows im14

If you look at the steps on the newly created workflow it is setup to post the document automatically when the document is released. Additionally a payment line will be created to pay that invoice, and at the end a notification is also created for the specified user.

Microsoft NAV 2016 workflows im15

Before we can enable this we need to setup a couple of things. First we need to define what journal (i.e. template and batch) to use when creating the payment line. To do this, edit the response on the second line on the workflow by clicking the assist edit button.

Microsoft NAV 2016 workflows im16

Secondly, which user we need the notification to be create for at the end of the workflow. To do this edit the response on the last line and then select the Recipient Use Id.

Microsoft NAV 2016 workflows im17

That’s it. Enable the workflow by checking the Enabled check box on the workflow card.

Now create a purchase invoice and Release it. You will see that the invoice is posted automatically in the background and a payment lines is created in the payment journal that we chose on the workflow.

Was this article helpful?