Business (working) Hours calculator for Dynamics CRM

By Dianna on 4/15/2014

 

CRM workflow can add time (days and hours) to a date/time field. To create a task 4 hours from now, and the date and time is Friday 4:00PM, the calculated time is 8:00PM same day, which is outside business hours, let’s say: Monday-Friday 8:00AM till 5:00PM. Adding 4 business (working) hours to Friday 4:00PM is actually, Monday 11:00AM. Moreover, if Monday is a Public Holiday then adding 4 business hours to Friday 4:00PM is Tuesday 11:00AM.

 

Here are two examples where you will use Dynamics Workflows Business Hours functionality:

Follow up Activity
Whether you have just completed a meeting, a phone call, sent an email or submitted price quotation, its best practice following it up within 2-4 working days. These are working days and we don’t wish to include weekends and public holidays. Dynamics Workflow includes a Dialog that displays a pick list for the user to select the number of days for follow up and based on the user’s selection it calculate the due date based on working hours, and creates a follow up activity for the due date & time

Response and Resolution Times for Service Level Agreement (SLA)
Service providers need to comply with Service Level Agreement (SLA) contracts that determine the maximum time allowed for first response to an incident and the maximum time allowed resolving a case. In Dynamics CRM the SLA contract is linked to Contract Template, which can either be normal business hours (like:9AM-5PM), extended business hours (like: 7AM-9PM) or 24x7. Dynamics Workflows can update the Response By & Resolve By fields in the case entity, as well as calculate the actual time it took to firstly response to a case and actual time to resolve it, based on the SLA Contract and Contract Template of the customer.

Dynamics Workflows comes with two examples to demonstrate how to create workflows to calculate the number of business hours between two dates and how to add business hours to a date/time field.

Workflow Example –Dialog to create follow up phone call after completed appointment

 

We use a Dialog with prompt text and a response type: Option Set (picklist)

The picklist has 2 fields: Label and Value.

This workflow is using contract template of 9 working hours Monday to Friday, therefore for the label: “3 working days” we enter “27” as value.

 

The next step of the workflow is using the Math Function of Dynamics Workflow to convert the value of the selected response (“27”) from text string to a number, as only numbers are accepted as business hours input in Business Hours function.


In Business Hour Function we select:
Contract Template: Business Hours
Date1:  the time the process is executed
Business Hours to add: the result of converting to number the value selected in the Prompt and Response Page

The below image shows the working hours as set in the Contract Template:

The final stage is to create a phone call with a due date is updated by the returned result of “Calculated new Date and Time”


 

 

Author