Bulk create CMDB Query Builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 06:36 AM
I need to create 100+ Dynamic CI's and we are using an approach given to us by ServiceNow support. This involves creating a CMDB Query Builder, then create a CMDB Group that uses the CMDB Query Builder, and then create a Dynamic CI using the CMDB group. Scripting the CMDB Group and Dynamic CI should be easy, but I am not sure if that is possible with CMDB Query Builder. The CMDB Query Builder will have the same 2 tables and filters, just different text for the search.
The table that holds these queries, qb_saved_query, does seem to have a common format and is very similar for these that are the same format, but occasionally I will see "$$hashKey":"object:3343" in the query and then it will disappear, and I am not sure what that is for or what triggers it. If not for that I think it would be easy to script this.
Thanks!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2024 09:20 AM
Hi @garyminnick
Refer this KB might be helpful
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0681251
Mark it helpful if this helps you to understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 05:54 AM
I looked over the article and did not find how to automate creation. Would you mind pointing out what section has that? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 06:30 PM
I am also trying to work out how to do this. None of that response answers your question. They need an unhelpful button also.
Here is an article on creating the Dynamic CI Groups and linking it back to Encoded Queries:
https://www.servicenow.com/community/developer-blog/csdm-create-dynamic-ci-group-using-script/ba-p/3...
If you can convert your dynamic CI Groups to encoded queries then this will work for you. If you can't, because there are multiple tables involved, you may be able to use this code as a starting point to create the Dynamic CI groups and link your CMDB Queries through to them, once you work out that part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 08:09 AM
I've been looking into scripting the creation of the CMDB Query Builder entries as well and found this thread. That led me to take a look at the APIs that are available.
The CMDBQueryBuilderAPI in Server Global provides a method called saveQuery that allows you to create a new query using JSon and returns the SysID.