Need help on merging the selected incident records and making one has parent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 10:56 PM
Hi,
I need to create a UI action called merge incident and when users select 2 or 3 incidents with the same short desc the popup window should trigger seeking for the incident number which should be a parent and when the user selects the incident which should be a parent and then remaining selected records should be made as a child and copy the emails and attachments to the parent record. Can anyone guide me on how this can be achieved.
Thanks in Advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 02:26 AM
Hi,
There is already an OOB feature you can use, a field on the Incident table which can be set to indicate it's a child incident to another incident.
So the easiest way to use this, is to show that field "Parent Incident" on the list view, and then from the list view multi select records that should be connected to a specific parent incident record.
Optionally you can create a Flow or business rule, that runs on after setting the parent incident field, and copies attachments from the child records to the parent.
Personally, I prefer not to copy attachments, since it creates duplicates of data, which might be unnecessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 04:37 AM
What is the purpose of adding a duplicate Incident as a child to the Incident it duplicates, from the same caller?>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 09:03 AM
Hi OlaN,
This we need to implement even for the call table so I need new UI action.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 10:27 AM
Hi @Dhanalakshmi D ,
Yes, you can have an UI action on list view, below the sample...
(function executeMergeIncident() {
// Check if at least 2 incidents are selected
var selectedIncidents = g_list.getChecked();
if (selectedIncidents.length < 2) {
alert('Please select at least 2 incidents to merge.');
return;
}
// Get the short description of the first selected incident
var shortDesc = '';
var parentIncidentSysId = '';
// Iterate through selected incidents
for (var i = 0; i < selectedIncidents.length; i++) {
var sysId = selectedIncidents[i];
var gr = new GlideRecord('incident');
if (gr.get(sysId)) {
// Check if short description is empty or matches the first incident
if (shortDesc === '' || gr.getValue('short_description') === shortDesc) {
shortDesc = gr.getValue('short_description');
// Set the first incident as the parent
if (parentIncidentSysId === '') {
parentIncidentSysId = sysId;
} else {
// Make the current incident a child of the parent
gr.setValue('parent', parentIncidentSysId);
gr.update();
}
} else {
alert('Selected incidents do not have the same short description.');
return;
}
}
}
})();
Configure the UI action:
- Name: Merge Incidents
- Table: Incident (or the table where you want to apply this)
- Action name: merge_incidents
- Client: true
- Show Insert: false
- Show Update: true
Please mark as Accepted Solution & HIT helpful if it suffice your requirement.
BR, Sohith