if incident is closed, CIM which was raised from incident also closed, but it should not happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
if incident is closed, CIM (sn_cim_register)which was raised from incident also closed, but it should not happen.
CIM was raised from an incident, which will show in related tabs. incident was closed, them CIM ticket as well closed by system, but I dont want to CIM ticket to be closed.
an you please help with code to be written in BR ("SNC - ITIL - Close Related"), as i am not aware of coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @nitin51 ,
Glad you found the BR that is automatically closing CIM ticket once incident is closed.
Please share the code to get understanding code.
You can make active false for this BR and then check if CIM ticket is getting close or not.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @nitin51
Looks like you already did the hard work of identifying the BR that is playing games with you.
If you want to explicitly disable this behavior for the CIM tickets, I would suggest the following:
Create a copy of the OOB BR - and do the following addition to the BR :
// >>> ADD THIS GUARD <<<
if (task.instanceOf('sn_cim_register')) {
gs.debug("[Close Related] Skipping CIM record {0} (table: {1}) when parent {2} closes",
task.number, task.getRecordClassName(), me.number);
continue;
}
// <<< END ADDITION >>>
In my PDI the BR would look like this with the above addition:
//
// Close any tasks that are related to the current task
//
function closeRelatedTasks(me) {
var task = new GlideRecord("task");
task.addQuery("parent", me.sys_id);
task.addQuery("sys_class_name", "!=", "kb_submission");
task.addQuery("sys_class_name", "!=", "incident");
task.query();
while (task.next()) {
// >>> ADD THIS GUARD <<<
if (task.instanceOf('sn_cim_register')) {
gs.debug("[Close Related] Skipping CIM record {0} (table: {1}) when parent {2} closes",
task.number, task.getRecordClassName(), me.number);
continue;
}
// <<< END ADDITION >>>
if (task.sys_class_name == 'problem')
closeProblem(task.sys_id, me.number);
else if (task.sys_class_name == 'change_request')
closeChange(task.sys_id, me.number);
else {
task.active.setValue(false);
task.update();
gs.print("Task " + task.number + ' closed based on closure of task ' + me.number);
}
}
this.closeIncident(me);
}
This should ensure that the BR is skipping CIM records.
please ensure that you DONT edit the OOB record directly!!
Copy the BR to your update set / app, prefix the name (e.g., “ZZ – Close Related (custom)”), activate your copy, and deactivate the OOB one. This avoids upgrade collisions. Please also note that depending on how CIM is related to the Incident in your instance (via parent or a custom field/Flow), this approach might not cover all paths and could have side effects.
Please validate on sub‑prod and review any other BRs/Flows that close CIM records to add similar guards where needed.
If this pointed you in the right direction, hit Helpful to spread the good vibes.
✅ If it cracked the case for you, mark it Correct so the next person doesn’t have to reinvent the wheel.