Search code examples
timerdynamics-crmdynamics-365

Dynamics 365: Stop and Restart Enhanced SLA Timer Programatically


So let say I have a Case that have an Enhanced SLA. Everytime a new email coming that is related to the case, I wanted to run a plugin that will stop/restart the SLA timer for the case (depending on the email content).

Is there any way to stop / restart the Enhanced SLA timer related to a case programatically?


Solution

  • You'll need to create an Enhanced SLA and configure it to Allow Pause and Resume.

    From https://www.microsoft.com/en-us/dynamics/crm-customer-center/define-service-level-agreements-customer-service.aspx#bkmk_CreateEnhancedSLA:

    Create an enhanced SLA

    Make sure that you have the Customer Service Manager, System Administrator, or System Customizer security role or equivalent permissions.

    When you activate an SLA, a corresponding workflow is also created. For every action you perform on the SLA, you must have permissions to perform the same action on workflows. The SLA is applied in context to the permissions that the owner of the SLA has.

    Check your security role

    Go to Settings > Service Management.

    Go to Service Level Agreements.

    To create a new SLA, click the New button.

    -OR-

    To edit an SLA, in the list of records, select the SLA, and then on the command bar, click Edit.

    If you're creating a new SLA, you'll see the Create SLA dialog box. Type a name for the SLA, and then select the entity for which you want to create the SLA.

    Fill in your information

    Applicable From. Select the field that specifies the date and time from which the SLA items will be calculated. For example, if you select the Created On field, the calculations for service level agreements will start from the time the record is created.

    Note You can have multiple SLA KPIs within one SLA. The start time for different SLA KPIs within an SLA is set at the SLA level and can't be different across SLA KPIs. The start time is determined by the Applicable From field value. Business Hours. Select a customer service schedule record that defines your support organization’s business hours. This is useful in the SLA time-tracking calculations. If a business hours record (customer service schedule) isn’t selected, the work hours are considered to be 24 x 7.

    SLA Type. Select Enhanced.

    If you're creating an SLA for an entity other than Case,, this field is automatically set to Enhanced, and can't be changed.

    Allow Pause and Resume. Select Allow if you want the SLA to pause during the time the record is on hold. For each entity that's enabled for SLA, you can set the statuses that will be considered “on hold” in the Service tab of System Settings dialog box. More information:
    System Settings dialog box - Service tab. You can set this field to Allow only when you’re creating an enhanced SLA.

    Click Save.

    Now you should configure the status values which will pause the SLA.

    From: http://blog.sonomapartners.com/2014/11/dynamics-crm-2015-sla-enhancements.html:

    Automatically Pause/Resume the SLA time Calculation:

    Now with CRM 2015, administrators can setup specific Active Case Status values that will automatically pause the SLA timer if the Case is moved into one of the statuses selected. When the Case is moved out of that status, the timer will resume and continue. This is configured from Settings –> Service Management –> Service Configuration Settings.

    In the example below, if a Case is moved into On Hold or Waiting for Details, the SLA timer will pause (and this will reflect on the Case form). When the Case is moved back to In Progress or Researching, the SLA timer will continue where it left off. This functionality is only available with Enhanced SLAs (described in more detail in the next section).

    enter image description here enter image description here

    You can now programatically change the case status, by updating the record (IOrganizationService.Update) to put the SLA on-hold and/or resume the SLA.