Views:

Overview

Microsoft Dynamics 365 for Field Service allows you to create Inspection Templates to facilitate inspections associated with a Work Order. The inspection questionnaires can have basic rules within them, however, these are static and all inspections based on the templates will have the same rules.

In some scenarios it would be preferable to be able to create truly dynamic questionnaires, changing the display and rules based on previous inspections - with the North52 business rules engine for Microsoft Dynamics 365 this can be done easily. 

This article will show how information from a previous inspection is used to change labels and question visibility rules.  To illustrate, we use a very simple scenario of a temperature reading inspection that is done periodically - however, we can support significantly more complex requirements.  The rules are defined below.  

Rules for Dynamically Generated Inspection Templates

Rule #Description
1

When there has been a previous inspection for the same Service Account and a Primary Incident Type of "Inspection", show the previous inspection date temperature on the next inspection:

"Previous Reading on [Date] was [Previous Inspection Response]°C"  

2

If the current inspection temperature is greater than the previous, then display a new required question:

"The previous inspection reading was [Previous Inspection Response]°C, what has happened?"

 

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

North52 Decision Suite Solution

The North52 Decision Suite solution works like this:

  • A Formula is set up on the Work Order which:
    • Finds and extracts data from a matching previous Inspection
    • Creates an Inspection Template record dynamically 
      • If a previous Inspection is found, the previous temperature reading is added to the first question and the previous temperature is used as a threshold for the second question 
    • Creates the corresponding Service Task Type and Work Order Service Task

Set up Formula

There are multiple sheets to process the logic and rules that generate the dynamic inspection questionnaires.

Find Previous Inspection

For the current Work Order we need to find if there is a previous Inspection record for the Service Account and Primary Incident Type, and if so get the JSON structure that they are stored in.

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

A dynamic FetchXML query is used to find this information. The {0} and {1} placeholders in the FetchXML is replaced at runtime with values from the current Work Order 

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Questionnaire Setup

Inspection Templates are defined by JSON and stored in the Dataverse record. The header information for the Questionnaire is defined on this sheet - we set the Questionnaire Title to contain the Work Order Number so that it can be easily associated to a specific Work Order.

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Dynamic Questions Rules

This sheet defines the questions that will be shown in the custom-generated inspection questionnaire. If a previous inspection record was found then details from that inspection can be included with the questions for the dynamically generated questionnaire. For example, in Cell E4 selected below, we are adding the previous reading date and temperature.  Additionally, we are adding a question with a visibility rule based on the previous temperature reading - this is defined in Row 6.

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Create Inspection Template Version

This sheet combines the values from the Questionnaire Setup and Dynamic Questions Rules sheets into JSON format and creates an Inspection Template record which will only be used for the corresponding Work Order

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Create Service Task Type

In order for the inspection questionnaire to be assigned to a Work Order Service Task, it needs to be associated with a Service Task Type. This sheet creates the Service Task Type which is unique to the Work Order and customized questionnaire.

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Create and Assign Service Task

The final step is to create and assign a Service Task (which associated to the Task Type created in the previous sheet) to the Work Order

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Questionnaire in Work Order Service Task

A new Work Order is created and the custom questionnaire is shown in the Service Task:

North52 Decision Suite - Business Rules Engine for Microsoft Dynamics 365

Did you know?

North52 has over 500 functions to help you implement advanced business rules and complex decision logic

One of the biggest costs on most Microsoft Dynamics 365/CRM project is custom coding. This is where consultants or developers are invloved in writing 100’s if not thousand’s of lines of code in Javascript and/or C#.

The Formula Manager, part of the North52 Decision Suite is a business rules engine that aims to eliminate this custom coding by using simple formulas instead. It is significantly faster (up to 10 times) than writing custom code and you get the added bonus of lower cost updates if a business rule changes in the future (it is much faster and thus cheaper to change it using a Formula rather than custom code).

There are over 500 functions available in the North52 Decision Suite business rules engine!

Learn more about North52 Business Process Activities