I need alert opened date should be populate on detection time filed in the incident

ashok17
Tera Contributor

I need alert opened date should be populate on detection time filed in the incident, Please suggest how to achieve this requirement and i have tried below After Business Rule on incident table but not works:

 

if (!current.u_detection_time && current.u_alert) {
var alertRec = new GlideRecord('u_alert');
if (alertRec.get(current.u_alert)) {
current.u_detection_time = alertRec.u_opened_at;
}
}

22 REPLIES 22

ashok17
Tera Contributor

Hi @Rakesh_M ,

 

I have updated as you mentioned above condition in the Business Rule but not works, please refer below screenshots and suggest:

 

ashok17_1-1777548497008.jpeg

 

ashok17_2-1777548504417.jpeg

 

Ankur Bawiskar
Tera Patron

@ashok17 

are you sure when BR runs the u_alert field on INC is populated?

Also since your BR is after simply setting the value won't help, it needs to be saved

You should have before Insert/Update BR with this script

if (current.u_detection_time == '' && current.u_alert) {
current.u_detection_time = current.u_alert.u_opened_at;
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Yes, the alert table was 'u_alert'