Build a Service Mapping query using the CMDB Query Builder Build a Service Mapping query in the CMDB Query Builder. A Service Mapping query is a pattern consisting of classes and relationships between those classes. After you build the pattern and run the query, the query returns all the Service Mapping services that contain that pattern. Before you begin Service Mapping must be activated. Role required: cmdb_query_builder (contained for itil and asset) About this task Build the query by dragging the CI classes that you want to include in the query, dropping them as nodes on the canvas, and then defining relationship properties between them. For every class node in the query, you can filter on its attributes to narrow down the results to a specific set of CIs of that class or to a single specific CI, and you can select the property columns that display in the query results. Query filters use related list conditions which allow the inclusion of a relationship with another table in the filter. For more information, see Add related list conditions. Authorized users have the ability to update and delete a query that was created by another user. Procedure Navigate to Configuration and click CMDB Query Builder. On the CMDB Query Builder page do either of the following: Click Create new. Type in a Name, choose Service Mapping Query as the Query type, and click Create. Click on a widget of a saved query to continue building an existing query. Point to the upper right corner of a saved query widget, and click the Duplicate Query icon to edit a copy of a saved query. The new query's default name contains the string 'copy'. Do any of the followings on the canvas: Add CI classes to the query: Select classes from the class hierarchy under CMDB Artifacts and drag them to the canvas. Add connections between two nodes on the canvas: On the first node in the relationship, click the small square at the center of the right side to toggle its color to blue. On the second node in the relationship, click the small square at the center of the left side to toggle its color to blue. In the Connection Properties dialog box: Choose the parent/child roles in the relationship and then configure the properties in the respective section of the connection properties. Click Add Relations and select a relationship from the list of existing relationships between the CIs (including descendant classes). Select No Relations to query for a pattern in which the two classes have no relationships with each other. For example, all Tomcat WAR CIs which are not connected to a Windows Server. Click Add Reference to choose a field that the parent class (including ascendant parent classes) uses to reference the child. Click Confirm. Table 1. Relationship UI Notations Notation Description Dotted line A relationship in a Service Mapping query. Red asterisk at the center of the connection line Information such as relationship type is missing, invalidating the query. Add filters to the query: The initial elements of a query are classes. Applying filters, you can narrow a class down to a specific set of CIs or to a single specific CI. Point to the node to add a filter to. Click the Apply Filters icon that pops up above the node. Add attribute and related list conditions. Close the Filters section on the canvas. For example add a filter for business criticality to query for businesses that are 'most critical'.Click Applied Filters in the navigation bar on the right to view all filters that were added for each node on the canvas. When you select a set of filters in the navigation bar, the respective node that these filters apply to, is highlighted. And, if you select a node, the respective set of filters that apply to that node, is highlighted. Add AND/OR operations to the query: Connect one node to two other nodes. Click the AND box that appears to toggle between the And and the Or operations. For example C1 is Tomcat WAR, C2 is Linux Server, and C3 is Windows Server. Query for all Tomcat WAR CIs which are connected either to Linux Server Or to a Windows Server. Add property columns to display in the query results:Note: For a relationship, the query results display the parent, child, and type columns. You cannot add any other columns from the [cmdb_rel_ci] table. Click the node to add properties to. Click the Properties tab, and then click Add Columns. Select the properties to display and then click outside the properties list to close it. Select columns and add filters that will be applied to the resulting set of services: Ensure that Properties is selected at the top on the right hand-side navigation bar, and then click an empty space on the canvas to ensure that nothing is selected. Click Add Columns at the bottom of the right hand-side navigation bar and select columns to add. Click the Apply Service Mapping Query Filters icon at the top of the canvas and add filters. Disable Services Including This Pattern to inverse the entire query and search for all Service Mapping services that do not include the query pattern. Modify the query: Apply filters: Click a node and then click the Apply filters icon to add or edit the node's filters. Modify relationship properties: Click the line that represents the relationship between two nodes to display the Connection Properties on the right hand side pane. Modify Query Builder settings: Click the Settings icon to display the Query Builder Settings dialog box. Toggle the Display Relationships in Results setting to indicate whether to display the relationship between CIs in the query results. Click the settings icon again to close the Query Builder Settings dialog box. What to do next Click Save. A saved Service Mapping query can be built into a CMDB query. In the Saved Queries tab, you can hover over a saved query widget and click the 'i' icon to view query information such as the query type, last update date, CMDB groups associated with the query, and the query schedules. Click Run. Note: When a query is running, wait for it to complete or to timeout before opening or running another query. The query results pane displays only the first 200 results of the query. Click Load More Results to display the next set of 200 results. Also, in the query results pane you can click a CI to open its CI form, and on the CI form you can click Dashboard to view CI health in the CI dashboard. Create a schedule to run the query at a future time, and to email the results to interested parties. Click the Export icon in the query results pane. The number of results that are exported is determined by the glide.cmdb.query.max_results_limit property, which by default is set to 10000. The exported file contains the query results with the addition of the CIs and relationship sys_ids. Populate a CMDB group using the saved query.