- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:34 AM
If you are trying to link a parent incident under the child Incident, the child incidents should be re-parented to the Incident you are on.
Example: If you are going to add INC2 as child Incident of INC1, but INC2 has 2 child Incidents (INC3 & INC4). When you link INC2 as a child to INC1, then INC3 and INC4 should get re-populated to INC1.
How can we achieve this.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:45 AM - edited 04-22-2024 04:45 AM
Hi @Delapan ,
You can do it with the below business rule :
(function executeRule(current, previous /*null when async*/) {
if (current.parent.nil() || current.parent == previous.parent) {
return; }
var childIncidents = new GlideRecord('incident');
childIncidents.addQuery('parent', current.sys_id);
childIncidents.query();
while (childIncidents.next()) {
childIncidents.parent = current.parent;
childIncidents.update();
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:45 AM - edited 04-22-2024 04:45 AM
Hi @Delapan ,
You can do it with the below business rule :
(function executeRule(current, previous /*null when async*/) {
if (current.parent.nil() || current.parent == previous.parent) {
return; }
var childIncidents = new GlideRecord('incident');
childIncidents.addQuery('parent', current.sys_id);
childIncidents.query();
while (childIncidents.next()) {
childIncidents.parent = current.parent;
childIncidents.update();
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....