Need to update Incident field based on sla business percentage
Options
- 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
(function executeRule(current, previous /*null when async*/) {
var slaGR = new GlideRecord('task_sla');
slaGR.addQuery('task', current.sys_id);
slaGR.addQuery('sla.name', 'P3 resolution'); // Match SLA name
slaGR.query();
if (slaGR.next()) {
if (slaGR.business_percentage < 100) {
current.u_sla_cal = 'Yes';
} else {
current.u_sla_cal = 'No';
}
}
})(current, previous);
Regards,
B
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 03:34 AM
when are you running this business rule?
script looks fine to me.
try this
if (parseInt(slaGR.business_percentage) < 100) {
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader