List Collector to Populate Affected CI's Related List
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2013 08:34 AM
Hi Everyone!
I have a requirement to add in a glide list field on the change form (the list collector with a lock in it) to populate the affected CIs related list.
I copied modified two business rules that is populating the related list, but it is adding the first choice over and over again and not adding the other CIs. I'm thinking I'd have to copy and modify the script include "ChangeCollisionHelper". Any ideas?
Sync CI in affected Cis List Picker
if (!previous.u_additional_affected_cis.nil())
removePreviousCI();
if (!current.u_additional_affected_cis.nil())
addCurrentCI();
function removePreviousCI() {
// Delete Affected CI records for this task and previous CI
var rec = new GlideRecord('task_ci');
rec.addQuery('task', current.sys_id);
rec.addQuery('ci_item', previous.u_additional_affected_cis);
rec.query();
while (rec.next())
rec.deleteRecord();
}
function addCurrentCI() {
//Create Affected CI record for this task and current CI
var rec = new GlideRecord('task_ci');
rec.addQuery('task', current.sys_id);
rec.addQuery('ci_item', current.u_additional_affected_cis);
rec.query();
if (rec.next())
return;
rec.initialize();
rec.task = current.sys_id;
rec.ci_item = current.u_additional_affected_cis;
rec.insert();
}
Add CI in affected Cis List Picker
perform();
function perform(){
if(!ChangeCollisionHelper.isCiInAffectedCis(current.u_additional_affected_cis,current.sys_id)){
ChangeCollisionHelper.addCiToChangeAffectedCis(current.u_additional_affected_cis,current.sys_id);
}
}
Thanks in advance for any help you can provide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2013 08:52 AM
Hi
You can leverage the functionality provided within the system.
The affect CI addition to a Change is already available through BSM map.Go to the CI on the map and select 'Add Affected CI' from the context menu.
Each selected CI will be added to the 'Affected CI' list on the change.
Affected CIs can be removed from the list through the 'Edit' option.
Is there a restriction/limitation within CMDB data/relationships which you are trying to address with the above scripts?
Regards
Parik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2019 10:22 AM
I could not find the 'Add Affected CI' from the context menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2013 09:39 AM
Hi Parik,
Thanks for the quick response and great suggestion. The requirement is to keep the user on the same page, with having to leave or save the change record before being able to add additional CIs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2013 08:49 AM
Anyone...?