How to add attribute on variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2014 11:10 AM
Hi all,
I am using List collector type of variable and the list table is [cmdb_ci]. There are more than 10 Lakh records in cmdb_ci table and most of them are blank so it is unable to visible in slush bucket. for that i want to add some attribute for e.g. if name is empty should not come in slush bucket.
First i don't know why cmdb_ci table record is not coming in slush bucket.
Second i want to filter according to class or name is empty them don't show in slush bucket.
See screen shot.
Any help will be more appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2014 11:44 AM
Hello Mukesh,
You can set the filters using Client Script, please refer below script for your reference:
function onLoad() {
//Apply a default filter to the list collector variable
var collectorName = 'configuration_items';
var filterString = 'name!=NULL^sys_class_nameANYTHING';
//Hide the list collector until we've set the filter
g_form.setDisplay(collectorName, false);
setCollectorFilter();
function setCollectorFilter(){
//Test if the g_filter property is defined on our list collector.
//If it hasn't rendered yet, wait 100ms and try again.
if (eval('typeof(' + collectorName + 'g_filter)') == 'undefined' ) {
setTimeout(setCollectorFilter, 100);
return;
}
//Find the filter elements
var fil = gel('ep');
//Hide the filter elements by un-commenting the following lines
/*fil.rows[0].style.display = 'none';
fil.rows[1].style.display = 'none';
fil.nextSibling.rows[0].style.display = 'none'; //Filter description text*/
//Reset the filter query
eval(collectorName + 'g_filter.reset()');
eval(collectorName + 'g_filter.setQuery("' + filterString + '")');
eval(collectorName + 'acRequest(null)');
//Redisplay the list collector variable
g_form.setDisplay(collectorName, true);
}
}
Please mark answer as correct/helpful, if it was really helpful
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2014 11:23 PM
Thanks for this reply.
Can i do with the help of attribute which we can put in variable attribute field. Reason i don't want to show it in filter only the filter record will come in slush bucket.
Regards,
Mukesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2014 11:53 PM
Hi Mukesh,
You can able to hide the filter in the slush bucket but i am not sure whether is there any other option to set your condition.
Only thing is that slush bucket will allow you to set a filter and will show the records based on the filter condition.
Mark this question if it is helpfull.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2014 11:57 PM
Yes i can hide the filter with "no_filter" attribute but same thing i want to put for empty configuration item name. please suggest if any option/way are available in service now.