Autopopulate affected location related list in Major Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:25 AM
Hi,
I have a requirement when an incident is added in a Major incident as a child incident, the lo caller's location from the user(sys_user) table will be added to the affected locations of both the child incident and major incident. How can I achieve that? Would it be possible using a flow designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:42 AM - edited 07-24-2023 10:28 AM
@Jet R When an incident is tagged under a parent incident, the tagged incident's parent field is automatically updated.
For example INC0001 is the parent incident reported, when you tag INC0002 under INC0001, the system will update the reference field "parent" of INC0002 with the sys_id of INC0001.
Please write a Business Rule after Insert/update, with the condition Parent IS NOT EMPTY . In the advanced tab write the script to insert a record into the table where the affected locations are stored.
wrote the below script to add an entry for parent incident & child incident.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.parent.u_major_incident==true){
var aff_loc=new GlideRecord('task_location');
aff_loc.initialize();
aff_loc.task=current.parent_incident;
aff_loc.location=current.caller_id.location;
aff_loc.insert();
aff_loc.initialize();
aff_loc.task=current.sys_id;
aff_loc.location=current.caller_id.location;
aff_loc.insert();
}
})(current, previous);
Note:- Before adding the affected location to the Parent incident, you may also have to check if that location is already added to the parent. Because there is a possibility that there are more than one incident reported from the same location and in that case above code will add duplicate records in the affected location.
Please mark the appropriate response as correct answer and helpful.
Thanks!!