Add and sum Business elapsed time that SLAS complete to a field on incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2024 02:06 PM - edited ‎10-10-2024 02:09 PM
Hello, I am trying to assign the Business elapsed time of the SLAs to a new field that I created called "Total SLA Business Elapsed Time" with the intention of adding up the Business elapsed time of all the SLAs in complete resolution of my incident.
Does anyone know how I can achieve this? I have tried with a Business rule but I cannot get it to assign me the elapsed time or the sum.
An example would be:
SLA 1 was completed in 1 minute and the group was changed.
SLA 2 was completed in 20 minutes and resolve for the group
What should be assigned to the Total SLA Business Elapsed Time field would be = 21 minutes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2024 05:14 PM
Hi @williams2 ,
Can you share your script to check why its not working.
You can use GlideAggregate API to get the sum of SLAs tagged to your Incident and get the Business elapsed time and update incident.
Below is the sample script.
var agg = new GlideAggregate('task_sla');
agg.addQuery('task', current.sys_id);
agg.addQuery('sla.type', 'resolution');
agg.addAggregate('SUM', 'business_elapsed_time');
agg.query();
if (agg.next()) {
totalBusinessElapsedTime = parseInt(agg.getAggregate('SUM', 'business_elapsed_time'), 10);
}
current.u_total_business_elapsed_time = totalBusinessElapsedTime;
Please select Accept/Help button if my answer addresses your query.
Regards,
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2024 03:18 PM
Hi @Swamy Malluri thanks for answer my post
Honestly, my script is very simple. I have it in a business rule towards the "task_sla" table that is executed after insert or update.
The only problem is that it is only assigning me the SLA Response time and I need it to assign me the SLA Resolution time and once there is a group change and a new SLA Resolution is generated, it will add up the SLA Resolution times.
Until the incident is closed, now it will add up all the SLA Resolution times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2024 06:08 PM
Hi @williams2 ,
Could you please elaborate your issue ? Do you want to consider resolution time only to update in Incident's total business elapse time ? or response SLA as well ?
What is output from your above script ?
Thanks & Regards,
Swamy