- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2023 04:15 AM
We have to Copy mandatory details to child incidents when parent incident is resolved.
Meaning, as per the OOB If a parent incident got resolved, child incidents will get auto resolved but without filling mandatory fields which result blank details in child. To avoid this we have to have one rule which will update the details as per parent.
if the child incident already have some value in it, then will have to remain and skip. Only update fields which doesn't have value in it (category, configuration item, business service, Assignment group).
This is the condition we used
current.isValidRecord() && current.state.changesTo(IncidentState.RESOLVED) && (current.child_incidents > 0)
am assuming after business rule here, please suggest and can help with code if possible.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2023 04:48 AM - edited ‎01-02-2023 04:48 AM
Hi @Roxi1 ,
In the after BR add below condition and script.
1] State changes to Resolved.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var paINC = current.sys_id;
var gr = new GlideRecord("incident");
gr.addQuery('parent_incident', paINC);
gr.query();
if (gr.next()) {
if (gr.category == "") {
gr.category = current.category;
}
if (gr.cmdb_ci == "") {
gr.cmdb_ci = current.cmdb_ci;
}
if (gr.business_service == "") {
gr.business_service = current.business_service;
}
if (gr.assignment_group == "") {
gr.assignment_group = current.assignment_group;
}
gr.update();
}
})(current, previous);
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2023 04:48 AM - edited ‎01-02-2023 04:48 AM
Hi @Roxi1 ,
In the after BR add below condition and script.
1] State changes to Resolved.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var paINC = current.sys_id;
var gr = new GlideRecord("incident");
gr.addQuery('parent_incident', paINC);
gr.query();
if (gr.next()) {
if (gr.category == "") {
gr.category = current.category;
}
if (gr.cmdb_ci == "") {
gr.cmdb_ci = current.cmdb_ci;
}
if (gr.business_service == "") {
gr.business_service = current.business_service;
}
if (gr.assignment_group == "") {
gr.assignment_group = current.assignment_group;
}
gr.update();
}
})(current, previous);
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thank you