- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 03:37 AM
Hi,
I am trying to use the CMDB Query builder to create a dynamic query that can be used in a Technical Service Offering.
The logic includes 2 CI classes; Server and MSFT SQL Instance. I am trying to create Technical service offerings for the the different environments and apply to the DB Instance. eg SQL Prod, SQL Test, SQL Dev. These can then have different criticality, support team, etc...
The logic relies on the environment of the server. If the server has a production environment then so will the database instance that runs on that server...
I have created the query however the results cannot be configured to exclude the servers and so cannot be used in in a dynamic CI group. The servers are part of another service offering and are supported by windows platform teams so I dont want to include them. I only want the instances.
The server is required for the logic to work in the query but should not be in the output, I only want the DB instances.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:16 AM
This is just how the Dynamic CI Groups/CMDB Groups work. They take ALL of the CIs returned in the Saved Query. For CMDB Groups created with standard filters (which is a common use case) you look for a specific set of CIs of a specified class that meet certain conditions. However, if you use a Saved Query to populate your CMDB Group, then it will include all of the CIs that are in that query.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 06:54 AM
Hi @CW7 ,
I trust you are doing great.
To implement this, we can navigate to the CMDB Query Builder and enter the following query in the natural language query box: "MSFT SQL Instance that runs on server whose environment is PRD". This query specifies that we are looking for MSFT SQL Instances that are associated with servers having a production environment.
After entering the query, it is important to ensure that the rest of the pane is empty before clicking the "Search" button. Once the search results are displayed, we can then click the "Run" button to execute the query.
By using this method, we can ensure that only the MSFT SQL instances that meet our specific criteria are returned in the result set, while excluding the servers themselves. This is particularly useful in situations where we want to create a dynamic CI group or technical service offering that only includes the relevant instances, without including the servers that support them.
If further filtering criteria are required, such as criticality or support team, these can be easily added to the query using the same natural language syntax. This allows us to create highly specific and targeted queries that meet our exact needs.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:01 AM
Hi Amit, thanks for your help.
The NLQ works so long as I don't include the "environment is prod/production". If I add this using the filter I get the exact same query as I made manually. This is not the problem, its a very simple query.
If I associate this query with a dynamic CI group and then display the group members it shows both SQL instances and Servers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:16 AM
This is just how the Dynamic CI Groups/CMDB Groups work. They take ALL of the CIs returned in the Saved Query. For CMDB Groups created with standard filters (which is a common use case) you look for a specific set of CIs of a specified class that meet certain conditions. However, if you use a Saved Query to populate your CMDB Group, then it will include all of the CIs that are in that query.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:21 AM
That way you can also use it to group things for modern support/stack support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:54 AM
Hi Whisperer,
Yes this seems to be the case after much testing. This is a significant limitation of this functionality IMHO as you can only use it for dynamic group queries containing the class you are querying. This is of no real advantage than using the encoded query on the CMDB group rather than a saved query.
For this use case I've worked out a business rule to populate the environment on the DB instance. I was hoping to use it (for other cases) in conjunction with running processes/installed software in combination with multiple ci classes...
You should be able to specify an output class as you would for generally in DB update queries despite what is in the query logic. Perhaps this will come in the future...