Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Need to update Incident field based on sla business percentage

Bijender
Tera Guru

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

Ankur Bawiskar
Tera Patron

@Bijender 

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader