Enhanced Service Level Agreements (SLA’s) are one of the most helpful features that the latest version of Microsoft Dynamics CRM has to offer. This feature can calculate the amount of time spent on a specific case or even the amount of time a case was on hold. However, SLAs cannot calculate the next work timestamp.
Consider the following scenario of escalating a critical case.
Challenge: You need to calculate the work timestamp that indicates when a critical case can be escalated based on a CSR’s calendar. If a critical case was created on Friday at 4:30pm and your CSR’s don’t work during the weekend, you need to add four hours to when the case is created and come up with a timestamp for when the case should be escalated. The timestamp should fall on a working day for a CSR. It could be on Monday or even Tuesday if it was a holiday weekend.
So how do you calculate a work timestamp based on a calendar in Microsoft Dynamics CRM 2015?
Solution: We create a custom entity that takes a calendar GUID (string, as CRM does not allow lookups to Calendar entity – CSR calendar), start time (DateTime – case createdon/modifiedon), hours, minutes, and seconds as integers for the amount of time to add to the start time. On the creation of this entity, a plugin is triggered that does the calculation and stores the result in the same record in the work timestamp field. Employing a custom entity gives the benefit of calling create from JavaScript, custom code or even from inside any other plugin.
The following are screenshots of how the entity looks before and after.
Above you can see that based on a provided start time, the CSR calendar, and amount of time; the plugin calculates the work timestamp.
I have bundled this in an unmanaged CRM 2015 solution that you can import. Also available is a complete plugin code in case you would like to use the code separately.
No comments:
Post a Comment