Related List to display all affected CI records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 03:57 AM
Hi,
In change request, when user adds additional CI's in related list affected CI tab, Then it should fetch all the records like incident, Problem, change and it should get displayed in the newly created section called "Related affected CI record".
any one please let me know how can I achieve this
Thank you
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 06:03 AM
My one worry about this is you would be querying the task table quite extensively for only sometime results, it may cause you some performance problems whilst loading the related lists.
but in essence you would query the task_ci table for the affected CIs, then for each CI add it's sys_id to a query on task where that CI is the cmdb_ci on a task.
var ids = '';
var tci = new GlideRecord('task_ci');
tci.addQuery('task',parent.sys_id;
tci.query();
while(tci.next()){
ids += tci.ci_item+',';
}
task table would be the table to query from
current.addActiveQuery();
current.addQuery('cmdb_ci','IN',ids);
query all tasks where any of my affected CIs are the active CI in that task. As I say that would be a rather long query and there may be a better way to do this on demand via an icon rather than a constant related list.