Need to update Incident field based on sla business percentage
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:09 AM - edited 04-29-2025 03:10 AM
Hi,
I need to update incident field when incident resolves check the SLA business percentage , if less than 100% update the field with yes else no.
Tried creating a before update business rule on incident table but not working
Regards,
B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:16 AM - edited 04-29-2025 03:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:26 AM
no still not working, tried to log the SLA name to see if its picking up the sla, but the logs shows undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:56 AM
Hello @Bijender ,
The script is working fine. Check the business rule conditions. try setting up when "State" changes to Resolve.
Tried in the Background scripts and working fine.
Output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:34 AM - edited 04-29-2025 03:36 AM
Hi @Bijender
Try the below script.
(function executeRule(current, previous /*null when async*/ ) {
var slaGR = new GlideRecord('task_sla');
slaGR.addQuery('task', current.sys_id);
slaGR.addEncodedQuery('business_percentage<100^sla.name=P3 resolution'); // CHANGE THE SLA NAME AS REQUIRED
slaGR.query();
if (slaGR.next()) {
current.u_sla_cal = 'Yes';
} else {
current.u_sla_cal = 'No';
}
})(current, previous);Regards,
Siva