Is it possible to filter out cmdb_ci based on sys_class_name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2018 11:20 PM
Hello All,
I need to filter out cmdb_ci list using query business rule.
var test=current.sys_class_name;
var test1=current.getValue('sys_class_name');
gs.log("&&&test"+test);
gs.log("@@@@test1"+test1);
if(current.sys_class_name=='cmdb_ci_server')
{ gs.log("&&&&&&before");
var encodedQuery='sys_class_name=cmdb_ci_server^operational_status=1';
current.addEncodedQuery(encodedQuery);
gs.log("&&&&&&after");
}
Am not able to enter to the if loop, because test and test1 are null and empty.
How can i solve this? Please advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018 10:55 PM
Hi Jeevan,
There are more than fifty classes, i want all records from those classes except few classes.
ie., Result should contain filtered record of few classes and all records of other classes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2018 12:33 AM
HI Swathi,
If you need to filter out a small number of classes try changing your encoded query to 'is not'
operational_status=1^sys_class_name!=cmdb_ci_unwantedclass1^ORsys_class_name!=unwantedclass2^ORsys_class_name!=cmdb_ci_unwantedclass3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2018 07:01 AM
Swati,
It is possible , you just need to change the encoded query . Easy way to build the encoded query is to open the cmdb_ci table in list view and use the condition builder to search for your choice of CI's ..then right click and copy the encoded query and add to business rule. Refer the below screenshot ,adjust the query as per your requirement and copy & past to the business rule.
Thanks,
Jeevan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2018 05:22 AM
Hi jeevan,
Thank you, I did as you said, but no result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2018 01:28 PM
Can you paste a screenshot of what you did ?