Configuration Items based on Category&Sub-Category
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2015 12:41 PM
I am trying to limit the Configuration Item list to a specific few that depend on Category and Sub-Category.
When I choose a Category and corresponding Sub-category, In the CI field, I want only certain CIs to be in the drop down.
How can I do this?
I notice that some of my CIs don't even have a Category section when I go to create a new one.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2015 01:43 PM
So how could I make it so that I limit to 10-20? I can't put the reference qualifier on the cmdb_ci definition because that will only be one combination of cat/sub cat.?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2015 01:50 PM
No Sam, as per my understanding you need to write : reference Qualifier.
javascript:"category="+current.<your category field name>+"^subcategory="+current.<your subcategory field name>
this will change the CI options dynamically ,as this javascript is taking your current choice of Cat & subcat.
As your Choices change your Total no of Ci record will change. can you please tell me Total no records present in your Ci table.??
Thanks & Regards
Govind Kumar Sharma
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2015 01:58 PM
There are currently about 2576 records. When I choose a cat and sub cat, I want it to dynamically limit the number of CI's I have to choose from. Do I write the ref qualifier in the cmdb_ci dictionary table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2015 02:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2015 04:17 PM
Make a script includes named: catsubcat with the script below.
function catsubcat() {
if (current.category == '' || current.subcategory == '') {
return;
}
else
var retval = "sys_idIN";
gs.log('both are populated');
var ci = new GlideRecord ('cmdb_ci');
ci.addQuery('category', current.category);
ci.addQuery('subcategory', current.subcategory);
ci.query();
while (ci.next()) {
retval += ci.sys_id + ",";
}
return retval;
}
Then in the Configuration item, use Advanced Ref qualifer, and add javascript: catsubcat()
Maybe this will get you close?