Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Want to get breach time field data from task_sla table and get it displayed in custom field created in incident table.

Arjun Yuva Teja
Tera Contributor

Hi All,

I need to get the data from breach time(planned end date) field in task_sla table and get it displayed in custom field in incident table form.I have tried many business rules by taking reference from community only but i cant able to get it.Can anyone help me giving the exact script required for it.Lets take the custom field as Date,Time(u_date_time).

Thanks,

Arjun. 

1 ACCEPTED SOLUTION

Hello Arjun,

 

You need to write before insert & update business rule on task_sla table. Also add condition as SLA definition changes in condition builder.

find_real_file.png

    if (current.task.sys_class_name == 'incident') {
        
        var gr = new GlideRecord('incident');
        
        if (gr.get(current.task.sys_id)) {
           
            gr.u_breach_date_time = current.planned_end_time;   // it will set the breach date-time in custom field of type date/time on incident form.
            
            gr.update();
            
        }
        
    }


It will gives you current SLA planned end time.

Hope this will help you.
Regards,

Sagar Pagar

The world works with ServiceNow

View solution in original post

5 REPLIES 5

Hello Arjun,

 

You need to write before insert & update business rule on task_sla table. Also add condition as SLA definition changes in condition builder.

find_real_file.png

    if (current.task.sys_class_name == 'incident') {
        
        var gr = new GlideRecord('incident');
        
        if (gr.get(current.task.sys_id)) {
           
            gr.u_breach_date_time = current.planned_end_time;   // it will set the breach date-time in custom field of type date/time on incident form.
            
            gr.update();
            
        }
        
    }


It will gives you current SLA planned end time.

Hope this will help you.
Regards,

Sagar Pagar

The world works with ServiceNow