- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 10:55 AM
On my model table there's a "Related List" of "Hardware->Model" which shows, shocker, all the hardware with the given model. I'd like to add a second related list of Hardware->Model, but I want to set the filter to be all devices with the current model, where the class does not match the "CMDB CI Class" specified on the model.
In other words, that would show me all our hardware where the class specified is most likely incorrect, and our Asset Managers need to investigate.
Is that possible to do, and if so, how?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 11:09 AM
Hi Scott,
You just need to define a new Relationship for the tables, and then add that as a new Related List.
Creating Defined Related Lists - ServiceNow Wiki
Just remember this very important point:
- When scripting your condition, current is the record to which you want to add queries while parent is the main record being displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 11:09 AM
Hi Scott,
You just need to define a new Relationship for the tables, and then add that as a new Related List.
Creating Defined Related Lists - ServiceNow Wiki
Just remember this very important point:
- When scripting your condition, current is the record to which you want to add queries while parent is the main record being displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 11:30 AM
I did something wrong apprently. I did this:
Applies to table: cmdb_model
Queries from table: cmdb_ci_hardware
Query with:
current.addQuery('sys_class_name', '!=', (function () {
var gr = new GlideRecord('cmdb_hardware_product_model');
gr.addQuery('inactive', false);
gr.addQuery('label', parent.cmdb_ci_class.toString());
gr.query();
gr.next();
return gr.value.toString();
})());
When I then add the related list to the model table, I see the tab, but the custom query is not there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 11:46 AM
Wouldn't it be easier to create a filter for the existing related list. So it defaults to all - and then you can go to filter> and select the one for class?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 11:51 AM
That would require somebody to add the filters every time though. I want it to just default to what I'm looking for.