Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 06:41 AM
I would like to know if anyone can help me with figuring out how to update secondary records.
I have the following script that will update the parent record (all records are parent unless the parent field is filled in) I need to find all secondary records and set the u_triage_sla_time on them. But not sure how to accomplish that.
(function executeRule(current, previous /*null when async*/) {
var parentID = current.sys_id;
var tableName = 'em_alert';
//var assignedTo = current.u_assigned_to;
var gdt = new GlideDateTime(new Date());
var emAlert = new GlideRecord(tableName);
emAlert.addQuery('sys_id',parentID);
emAlert.query();
while (emAlert.next()){
//gs.info('@@@ UpdateTriageTime completed at ' + gdt);
emAlert.setValue('u_triage_sla_time',gdt);
emAlert.update();
}
})(current, previous);
Need to do with this script:
1. Find any other record in the em_alert table that has the parent field the same as the current sys_id (all child records) I can do the update part just need to know how to find all child (secondary) alerts.
Solved! Go to Solution.
Labels:
- Labels:
-
Scripting and Coding