- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 12:58 PM
Hello Community,
I was wondering if there was a way of copying related CI items from one CI to another. i.e.
Take CI related items from one CI:
and copy it to another CI:
I would hate to have to replicate these relationships manually:
Thanks for your help in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 02:21 PM
So it looks like i had to hack it for now.
I had to do a source code injection.
Steps:
open up the relationship items for the table that has all the CI relationships configured all ready.
right click the relationship table to inspect the element.
copy the "select id" of the table with the CIs (it should contain the sys_id's of the CI items were trying to copy).
paste the string into a code editor in preparation to paste into another ci:
Open another CI that you would like to copy the related CI items to:
right click on the "select id" segment like in the previous CI and paste the code we copied from the editor here:
Click on one of the items to make the "Apply" button live and register all the updated data that was inputted:
And "BAM" easy copied solution for related CIs from one CI to another.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 01:10 PM
There is not a copy button, but you are looking to update the record on the cmdb_rel_ci table. If you find that first CI and replace or copy the new Ci you can technically replicate or replace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 01:14 PM
Hello Jake,
Thank you for your prompt response. I am not sure if this would work in my current situation because the CIs were created from a discovery tool and it captured some important components that it added to the CI so I do not want to lose that information.
I do get what you are saying though and makes sense. I would love to hear the process that would accomplish what you are recommending.
Would it be possible if you could describe, in as much detail as possible, the method you are suggesting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 02:21 PM
So it looks like i had to hack it for now.
I had to do a source code injection.
Steps:
open up the relationship items for the table that has all the CI relationships configured all ready.
right click the relationship table to inspect the element.
copy the "select id" of the table with the CIs (it should contain the sys_id's of the CI items were trying to copy).
paste the string into a code editor in preparation to paste into another ci:
Open another CI that you would like to copy the related CI items to:
right click on the "select id" segment like in the previous CI and paste the code we copied from the editor here:
Click on one of the items to make the "Apply" button live and register all the updated data that was inputted:
And "BAM" easy copied solution for related CIs from one CI to another.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2016 03:49 PM
Yikes that is quite the process. I would have suggested something i feel is simpler such as a find and replace script dealing with Sys_ids.
For Example:
(function copyRels(){
var copyCI = 'the sys_id of the CI you are wanting to copy';
var newCI = 'the ci to copy to';
var gr = new GlideRecord('cmdb_ci_rel');
gr.addQuery('parent',copyCI);
gr.query();
while(gr.next()){
gr.parent = newCI;
gr.insert();//copy the record!
}
})();
Not tested, but something you could consider next time.