Due Date SLA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 04:42 AM
Hi Team,
I need to set the Sla duration time based upon the due date field which is present on the Request item form.
Indetail:
I have field on the Request item form. So based upon this date the duration of sla need to set.
Due date (req item form) should match the duration of Sla.
Thanks,
Ajay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 01:36 AM
Hello Navdeep,
I pasted the same script but the Breach Time of the Task SLA is not setting to the value in the "Due date" .Please refer the screen shot and inform me if I have done any mistake.
Here the due date is a field on req item form which is getting populated from the workflow.
In the above screen shot the due date:25 july
Breach time:20 july.
Actual elapsed time:25 july.
I did not understand the difference between the breach time and the Actual elapsed time..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 01:48 AM
Could you please share the screen shot of your SLA definition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 01:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 02:11 AM
It works on my developer instance. Try to print logs of due date in Relative Duration Script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 07:28 AM
Is there anything in your workflow or in a business rule that is changing the due date? Due date-based SLAs in Jakarta will not recalculate by default when the due date changes. If you want the SLA to update, then you need to put in a business rule on the sc_req_item table that will reset the planned_end_time to match the due date on any SLA where the definition is based on task due date.
Here is what I have done for this:
When to run: after (or async)
Update: true
Conditions: Due date changes AND due date is not empty
Script:
(function executeRule(current, previous /*null when async*/) {
// Check for task SLAs configured to run on due date. Need to change the end time in order to recalculate.
// Get running task SLAs
var ts = new GlideRecord('task_sla');
ts.addActiveQuery();
ts.addQuery('sla.duration_type','5d3bf3e5eb5322002a7a666cd206fe8e'); // Breach on Due Date
ts.addQuery('task',current.getUniqueValue()); // Look for any running SLAs for the current task
ts.query();
while (ts.next()){
// Reset the end_time on the SLA to match the current due date
ts.setValue('planned_end_time',current.getValue('due_date'));
ts.update();
}
})(current, previous);
Note that there is no "history" to show that the SLA was reset. It may be better to cancel the running SLA and let the system insert a new one. You definitely want to audit due date changes, otherwise users can just change the due date to avoid an SLA breach. There may be legitimate reasons for changing the date, though.
Let me know if that helps.
Thanks,
Nick
***EDIT***
Updated the script above to include the current task in the task_sla query. Otherwise, you get ANY active task SLA that is based on due date.