- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 07:45 AM
Hi,
I have created a Database View on CMDB CI table and custom table. When I am try to report on the DB View, I can able to see all the records.
My requirement is to show only Specific Class records while reporting on the DB View which I have created for that I have created Business Rule on the DB View.
Sample Code:
When to Run: Before and Query
current.addQuery('sys_class_name','cmdb_ci_cluster');
current.addActiveQuery();
But this is not working. Still I can see all classes in report.
Is there is anyway to show only specific Class records in report of the DB View
Thanks in advance
Upender
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 12:40 PM
This code worked.
var qc = current.addQuery('conf_sys_class_name','cmdb_ci_lb_ace');
qc.addOrCondition('conf_sys_class_name','cmdb_ci_lb_cisco_gss');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 10:03 AM
Hi Laurent,
Thanks for your reply it worked.
Now I tried to add more classes' in Business Rule, its not working. I can see all classes' records in report.
var gr = new GlideRecord(u_cmdb_ci); // DB View Name
var qc = gr.addQuery('conf_sys_class_name','cmdb_ci_cluster');
qc.addorcondition('conf_sys_class_name','cmdb_ci_esx_resource_pool');
qc.addorcondition('conf_sys_class_name','cmdb_ci_lb_ace');
gr.addActiveQuery();
Regards,
Upender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 10:21 AM
The functions are case sensitive, you need to use "addOrCondition" and not "addorcondition"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 10:30 AM
I tried its not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 01:06 PM
You can try to disable the query rule and open the database view without query rule. Then build the filter you want, test it and do a right click on the blue link filter and click on Copy query. You can then use that query in your script using current.addEncodedQuery('copied_query').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 12:38 PM
Hi Laurent,
It didn't worked.
Regards,
Upender