- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 02:41 AM
Hi,
please find below interview use case :
How to get the count of SLA attached to particular incident ?
Solved! Go to Solution.
- 487 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:19 AM
Hi @Hiteish222
You can get via report , where you need to enter the specific incident number in condition.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:19 AM
Hi @Hiteish222,
Please find the below script for the solution of above scenario:
//get sys_id of the incident
var incidentSysId = 'ed92e8d173d023002728660c4cf6a7bc';
var slaCount = new GlideAggregate('task_sla');
slaCount.addQuery('task', incidentSysId);
slaCount.addAggregate('COUNT');
slaCount.query();
if (slaCount.next()) {
gs.info('Number of SLAs attached to the incident: ' + parseInt(slaCount.getAggregate('COUNT')));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:19 AM
Hi @Hiteish222
You can get via report , where you need to enter the specific incident number in condition.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:19 AM
Hi @Hiteish222,
Please find the below script for the solution of above scenario:
//get sys_id of the incident
var incidentSysId = 'ed92e8d173d023002728660c4cf6a7bc';
var slaCount = new GlideAggregate('task_sla');
slaCount.addQuery('task', incidentSysId);
slaCount.addAggregate('COUNT');
slaCount.query();
if (slaCount.next()) {
gs.info('Number of SLAs attached to the incident: ' + parseInt(slaCount.getAggregate('COUNT')));
}