Dynamically setting SLA Duration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 09:22 AM
I have a requirement to set the SLA Duration by a Target Date field (u_target_date) from a Problem ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2017 08:27 AM
Which timezone do you want to use for the hours?
The second part of your script might not be necessary (calcScheduleDuration method sets also planned end time and seconds for SLA, no need to additionally call calcRelativeDueDate). If you try this code, you will end up having SLA planned end time set to the "endDateTime". You might want to play around the time and the timezone as in this way, it will be stored into database as 17:00, but actually user might see then different time.
var endDateTime = new GlideDateTime(current.variables.requested_date + ' 17:00:00');
calculator.calcScheduleDuration(calculator.startDateTime, endDateTime);
I would also propose to use "calculator.startDateTime" instead of "startDateTime" as this might cause incorrect calculations of SLA, but I did not verified that - however I always use calculator.startDateTime as start date time of Task SLA should not change - even if this script is running later again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2017 12:27 PM
I am not following.... This afternoon i tried to enter another ticket with a SLA of 3/17/17 and my log shows that my diffDays is 5 excluding the weekends that falls short 1 day.