Dedup/Merge of CI extended table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 12:06 PM
Hi All,
I have a requirement where we are removing SDLC component table (extended from cmdb_ci). Before we remove this, we want to merge the related list items and relationships from these records to a corresponding Application Service record. My first thought was to use Dedup/Merge, but because there are 120 records, it is a lot of manual work. Is there a better way or script to achieve this? Any leads or help appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 12:52 PM
Hi @snowE,
I see that the cmdb_ci_service_auto extends cmdb_ci_service, extends cmdb_ci. And cmdb_ci_sdlc_component extends cmdb_ci. So you can write a script to process records in the cmdb_ci_sdlc_component table, and then update fields in the cmdb_ci_service_auto table. Those Reference fields on both should still be valid. If there are reference fields on the cmdb_ci_sdlc_component that do not exist on the cmdb_ci_service_auto table, then those won't "transfer" and you'll need to add custom fields to cmdb_di_service_auto, and the script will have to populate values from the cmdb_ci_sdlc_component table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 08:09 AM
Do you have an example script which merges Related list records like INC CHG and CI relationships?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 08:41 AM - edited ‎09-21-2023 11:04 AM
No, you need to be specific on which tables have a List field that references the 'cmdb_ci_sdlc_component ' table. And the field names on those tables. Once known, then a script can be written.
But I see that in my instance, I don't have any Reference or List fields for the 'cmdb_ci_sdlc_component' table.
https://[instance_name].service-now.com/sys_dictionary_list.do?sysparm_query=internal_type%3Dglide_list%5Ereference%3Dcmdb_ci_sdlc_component&sysparm_view=
and
https://[instance_name].service-now.com/sys_dictionary_list.do?sysparm_query=internal_type%3Dreference%5Ereference%3Dcmdb_ci_sdlc_component&sysparm_view=
both show 0 records
I found this:
The accepted solution there Needs testing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 09:08 AM
Hi @snowE ,
Hope you are doing great.
Certainly! To achieve this, you can use a scripted approach in ServiceNow. Here's a high-level outline of the steps you can follow:
-
Identify Records for Merge : Use a script to identify the records in the SDLC component table that need to be merged.
-
Write a script to find the corresponding Application Service record for each SDLC component.
-
Use GlideRecord queries to copy related list items (like attachments, comments, etc.) from the SDLC component to the corresponding Application Service record.
-
Update any relationships or references pointing to the SDLC component to now point to the Application Service record.
-
Update any relationships or references pointing to the SDLC component to now point to the Application Service record.
-
Once all the data is safely transferred, you can delete the SDLC component records.
Regards,
Riya Verma