Mastering Microsoft Dynamics NAV 2016
上QQ阅读APP看书,第一时间看更新

Workflows in Microsoft Dynamics NAV 2016

In this section, we will learn how to create and use Workflow in Microsoft Dynamics NAV 2016. This section will explain the new basic workflow functionality of Microsoft Dynamics NAV 2016, which is awesome.

We will cover the following steps to make you better understand the workflow functionality:

  • Introduction to the workflow functionality
  • Set up the prerequisites for a workflow
  • Workflow demo

Introduction to workflow

Workflow enables you to understand modern life business processes along with the best practices or industry standard practice, for example, ensuring that a customer credit limit has been independently verified and the requirement of two approvers for a payment process has been met.

Workflow has these three main capabilities:

  • Approvals
  • Notifications
  • Automation

Workflow basically has three components, that is, Event, Condition, and Response. When Event defines the name of any event in the system, whereas On Condition specifies the event, and Then Response is the action that needs to be taken on the basis of that condition. This is shown in the following screenshot:

Introduction to workflow

Note

We need to differentiate between a workflow, which is a collection of one or more Event. Response is designed and managed through a designer (as shown in the preceding screenshot) and workflow Template, which is a mechanism to deliver the workflow process to the NAV System.

Setup required before using workflow

The following setup is a prerequisite for the workflow functionality, which I will just discuss briefly:

  • SMTP Mail setup
  • Job queues
  • Approval User setup
  • Workflow User group
  • Notification setup
SMTP Mail setup

For SMTP setup, go to the SMTP Mail Setup page from the RTC client, and fill in the SMTP Server name, SMTP Server Port number, and the Authentications option. You just need to make sure that your e-mail setup is working, as shown in this screenshot:

SMTP Mail setup

Job queues

We will use the default job queue just to make sure that the actions run in the background. Just click on Start Job Queue:

Job queues

Approval User setup

Just make sure you have a well-defined Approver Setup. Microsoft Dynamics NAV 2016 has a very easy user setup process. You can take a look at the following screenshot to see how it can be done:

Approval User setup

Workflow User Group

The Workflow User Group window is new in Dynamics NAV 2016. It introduces the possibility to create a user group for approvals. It includes a sequence number. As shown in the following screenshot, both users have the same sequence, which means that both users will get the notification at the same time. If it were different, then the notifications would be sent as per the sequence:

Workflow User Group

Notification Setup

In Microsoft Dynamics NAV 2016, we not only find different notification templates, but we can also create new ones. For example, by default, the standard notification for approvals is an e-mail. We can change the schedule as per our need. Open Notification Setup, and refer to the following screenshot to change the schedule:

Notification Setup

Workflow demo

We can use the workflow functionally for various operations. Let's take an example of the Customer Approval workflow. Here we will need to approve the customer if the credit limit is changed. We will set up our workflow accordingly to show a better picture of the process.

Setting up the conditions

Let's set up the scenario for testing the workflow functionality of Microsoft Dynamics NAV 2016.

Following are the steps to set up the conditions:

  1. Follow this link for workflow in Role Tailored Client of Microsoft Dynamics NAV 2016:

    Departments | Administration | Application Setup | Workflow | Workflows

    Or you can directly type workflow in the Search pane.

  2. Create a new workflow. Let's use New Workflow from Template. This will create a workflow with a template, which we can modify later. Refer to the following screenshot:

    Setting up the conditions

    The workflow steps will appear in the window, and now we can modify as per our requirements.

  3. To see how the workflow functionality works, let's take an example where a credit limit greater than 1,000 will trigger an event, which will generate some response.

    For this, click on the AssisEdit button in the On Condition column on the first line Approval of a customer is Requested.. Add the condition Credit Limit(LCY) is > 1,000 in a new window:

    Setting up the conditions

    Note

    We can add more responses just by clicking on the AssistEdit button of a record in the Then Response column. Then click on Add More Responses. You can also assign recipient information for that response.

  4. Edit the reponses of the line. In the Workflow Responses window in Approver Type, select Workflow User Group, which we created for this demo. Now select the MYWFUSERGROUP code in the Workflow User Group Code field:

    Setting up the conditions

  5. Click on the Enable Boolean button, and then you are done with configuring the workflow setup:

Setting up the conditions

Testing the workflow

Now we will run the system to test the workflow functionality and get impressed.

Following are the steps to test the workflow:

  1. Go to a customer card-for example, customer number 2000, and change the credit limit to a value greater than 1,000( here, 1,200.00):

    Testing the workflow

    Here we set 1,200.00 as the credit limit value, and click on the Send Approval Request button on the ribbon bar.

    Now we will see how the whole logic works in the system.

    Note

    Here the customer will be restricted, since it violates the workflow rules. Just make sure your workflow is set to active, or else no response will be observed.

  2. Now we will create a Sales Invoice page with Sell-to Customer, the customer whose credit limit we just changed, that is, customer number 2000, and Post the Sales Invoice page:

Testing the workflow

Output of the workflow

The steps that we performed in the previous section will create lines in the Approval Request Entries page, one for Approver 1 and one for Approver 3, with the same sequence number as to which our setting was defined.

This will also create notifications for both users, which can be seen in the Notification Entries page.

Once the approver approves the customer, the process can move further, but until then, the customer will be blocked for any kind of similar transactions.

Hopefully, you must've understood how the workflow feature can be utilized to make our process flow more precisely, and to restrict any unauthorized activity.