- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2017 07:25 AM
All,
I have a business requirement to restrict the list of CI choices based on selected category/subcategory on the incident form.
So for example, we have a category = Hardware and a Subcategory = Computer. In the configuration item field I'd like to have only configuration items found in the cmdb_ci_computer table display in the list of choices for the Configuration Item list.
I've been able to make this happen using the following:
However, I need this to be more dynamic so that it filters the CI list based on the subcategory selected. We have determined which CI classes will display under Hardware (for example, computer, printer, server, etc) so when a person selects Computer the CI list should only include the CIs contained within the cmdb_ci_computer table; when Server is selected the CI list should only contain all the CIs associated with cmdb_ci_server, etc.
Our goal is to use CI-based routing for task group assignments (Incident, Problem, Change). to do so we'd like to restrict the CI list to just the items found based on the category/subcategory options selected.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2017 09:53 PM
Hi Daniel,
I did tested the piece of code in my instance , and the below code is working fine.
var RefQualUtils = Class.create();
RefQualUtils.prototype = {
initialize: function() {
},
getCIRefQual : function(current) {
var filter = '';
gs.addInfoMessage(current.category);
if(current.category == 'software') {
return "sys_class_name=cmdb_ci_appl";
}
},
type: 'RefQualUtils'
};
Note : the current.category takes "software" ( Value in the category choice list") not "Software"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2017 04:48 AM
Sujan
Thank you kindly for the snippet and value hint as this set me up for success and on the right path. A few tweaks for my environment and this works perfectly.
Much appreciated, Deb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 03:38 PM
Having basically the same situation, we are trying to filter the CI to show the end user hardware only when the category selected is 'End User Hardware'.
Could be the reason for the script above didn't work for me because of the spaces between words "End User Hardware"?
I think it should not, as they are between quotes, right?
p.s.: I figured out. I should be using the 'value', not the category name.