ServiceNow CMDB Search
Subplaybook for finding CI records in ServiceNow CMDB.
ServiceNow · 13 tasks · 4 inputs · 2 outputs
Details
| ID | ServiceNow CMDB Search |
|---|---|
| From Version | 6.0.0 |
| Tasks | 13 |
README
Subplaybook for finding CI records in ServiceNow CMDB.
Dependencies
This playbook uses the following sub-playbooks, integrations, and scripts.
Sub-playbooks
This playbook does not use any sub-playbooks.
Integrations
- ServiceNow CMDB
Scripts
- ToTable
- Exists
Commands
- servicenow-cmdb-records-list
- servicenow-cmdb-record-get-by-id
Playbook Inputs
| Name | Description | Default Value | Required |
|---|---|---|---|
| SearchCIClass | The CMDB CI class to perform the search on (Defaults to cmdb_ci). | cmdb_ci | Optional |
| SearchQueryField | The CI field used to perform the query (Defaults to ip_address). | ip_address | Optional |
| SearchQueryValue | The value used to perform the query. | Required | |
| BypassAddRecord | Value to determine if the “add asset to CMDB” branch should be skipped in order to prevent direction to manual task. By default this is set to “false” but a “true” value will bypass. | false | Optional |
Playbook Outputs
| Path | Description | Type |
|---|---|---|
| ServiceNowCMDB.Record | Discovered CI records | unknown |
| ServiceNowCMDB.Records | A list of all the records that were found in the CMDB table. | unknown |
Playbook Image

Inputs
SearchCIClass— The CMDB CI class to perform the search on (Defaults to cmdb_ci).SearchQueryField— The CI field used to perform the query (Defaults to ip_address).SearchQueryValue— The value used to perform the query.BypassAddRecord— Value to determine if the "add asset to CMDB" branch should be skipped in order to prevent direction to manual task. By default this is set to "false" but a "true" value will bypass.
Outputs
ServiceNowCMDB.Record— Discovered CI recordsServiceNowCMDB.Records— A list of all the records that were found in the CMDB table.
Commands used
servicenow-cmdb-record-get-by-id
servicenow-cmdb-records-list
Flowchart
id: ServiceNow CMDB Search version: -1 name: ServiceNow CMDB Search description: | Subplaybook for finding CI records in ServiceNow CMDB. starttaskid: "0" tasks: "0": id: "0" taskid: 95a33aa0-456c-4999-8d67-99c7e5559368 type: start task: id: 95a33aa0-456c-4999-8d67-99c7e5559368 version: -1 name: "" iscommand: false brand: "" description: '' nexttasks: '#none#': - "14" separatecontext: false view: |- { "position": { "x": 450, "y": 570 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "4": id: "4" taskid: d36ad1f6-c15d-47b5-878b-ee4a128b7ec1 type: regular task: id: d36ad1f6-c15d-47b5-878b-ee4a128b7ec1 version: -1 name: Search for CMDB record description: Query records for a CMDB class. script: ServiceNow CMDB|||servicenow-cmdb-records-list type: regular iscommand: true brand: ServiceNow CMDB nexttasks: '#none#': - "8" scriptarguments: class: simple: ${inputs.SearchCIClass} query: simple: ${inputs.SearchQueryField}=${inputs.SearchQueryValue} separatecontext: false view: |- { "position": { "x": 450, "y": 920 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "5": id: "5" taskid: 3f33ff9e-9141-4a55-8cd4-c4be43ec194d type: regular task: id: 3f33ff9e-9141-4a55-8cd4-c4be43ec194d version: -1 name: Get record by ID description: Query attributes and relationship information for a specific record. script: ServiceNow CMDB|||servicenow-cmdb-record-get-by-id type: regular iscommand: true brand: ServiceNow CMDB nexttasks: '#none#': - "16" scriptarguments: class: simple: ${inputs.SearchCIClass} sys_id: complex: root: ServiceNowCMDB.Records accessor: sys_id separatecontext: false view: |- { "position": { "x": 450, "y": 1360 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "6": id: "6" taskid: 47156e2a-4f91-4926-8b0b-a84bb3ea80b3 type: regular task: id: 47156e2a-4f91-4926-8b0b-a84bb3ea80b3 version: -1 name: Fetch related CMDB CI by ID description: Query attributes and relationship information for a specific record. script: ServiceNow CMDB|||servicenow-cmdb-record-get-by-id type: regular iscommand: true brand: ServiceNow CMDB nexttasks: '#none#': - "13" scriptarguments: class: simple: cmdb_ci sys_id: complex: root: ServiceNowCMDB.Record.Attributes.cmdb_ci accessor: value separatecontext: false view: |- { "position": { "x": 450, "y": 2040 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "7": id: "7" taskid: cde6d170-9365-4889-86f2-e6e3400626d0 type: title task: id: cde6d170-9365-4889-86f2-e6e3400626d0 version: -1 name: Playbook End type: title iscommand: false brand: "" description: '' separatecontext: false view: |- { "position": { "x": 1320, "y": 2530 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "8": id: "8" taskid: d9396b1e-671e-4684-8177-8d10a6c2709d type: condition task: id: d9396b1e-671e-4684-8177-8d10a6c2709d version: -1 name: Do records exist? description: Check if a given value exists in the context. Will return 'no' for empty empty arrays. To be used mostly with DQ and selectors. scriptName: Exists type: condition iscommand: false brand: "" nexttasks: "no": - "15" "yes": - "5" scriptarguments: value: simple: ${ServiceNowCMDB.Records} separatecontext: false view: |- { "position": { "x": 450, "y": 1090 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "9": id: "9" taskid: 163630a4-45e6-40c9-84a5-2b9d9f4fe3a6 type: condition task: id: 163630a4-45e6-40c9-84a5-2b9d9f4fe3a6 version: -1 name: Add asset in CMDB? type: condition iscommand: false brand: "" description: "Determines if you should add the asset into CMDB (manual task)." nexttasks: "No": - "7" "Yes": - "10" separatecontext: false view: |- { "position": { "x": 900, "y": 1810 } } note: false timertriggers: [] ignoreworker: false message: to: simple: Analyst subject: body: simple: Do you want to add this asset in the CMDB? methods: [] format: "" bcc: cc: timings: retriescount: 2 retriesinterval: 360 completeafterreplies: 1 completeafterv2: false completeaftersla: false replyOptions: - "No" - "Yes" skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "10": id: "10" taskid: f66dc3c1-9989-4920-8abc-ffc7ad432413 type: regular task: id: f66dc3c1-9989-4920-8abc-ffc7ad432413 version: -1 name: Manually add asset in CMDB description: The asset is not in your CMDB, please manually add asset in ServiceNow type: regular iscommand: false brand: "" nexttasks: '#none#': - "7" separatecontext: false view: |- { "position": { "x": 900, "y": 2040 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "13": id: "13" taskid: 76fe59cd-cf7c-44a1-8f8b-7d4751fee3b2 type: regular task: id: 76fe59cd-cf7c-44a1-8f8b-7d4751fee3b2 version: -1 name: Save CMDB information in Evidence description: Convert an array to a nice table display. Usually, from the context. scriptName: ToTable type: regular iscommand: false brand: "" nexttasks: '#none#': - "7" scriptarguments: columns: simple: name,sys_class_name,sys_id,asset.display_value,asset.link,asset.value data: complex: root: ${ServiceNowCMDB.Record accessor: Attributes} separatecontext: false view: |- { "position": { "x": 450, "y": 2250 } } note: false evidencedata: description: simple: CMDB Evidence customfields: {} timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 continueonerrortype: "" isoversize: false isautoswitchedtoquietmode: false "14": id: "14" taskid: 2c408998-b0a1-4ea0-85cc-1eea917159cc type: condition task: id: 2c408998-b0a1-4ea0-85cc-1eea917159cc version: -1 name: Is ServiceNow CMDB enabled? description: Determines if the ServiceNow CMDB integration instance is configured to continue with playbook. type: condition iscommand: false brand: "" nexttasks: '#default#': - "7" "yes": - "4" separatecontext: false conditions: - label: "yes" condition: - - operator: isExists left: value: complex: root: modules filters: - - operator: isEqualString left: value: simple: modules.brand iscontext: true right: value: simple: ServiceNow CMDB - - operator: isEqualString left: value: simple: modules.state iscontext: true right: value: simple: active iscontext: true right: value: {} continueonerrortype: "" view: |- { "position": { "x": 450, "y": 710 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "15": id: "15" taskid: 595fef6d-8bc5-4cd4-8713-bb70d6892ea2 type: condition task: id: 595fef6d-8bc5-4cd4-8713-bb70d6892ea2 version: -1 name: Was bypass input set to "true"? description: Determines if the ${inputs.BypassAddRecord} input was set to "true" in order to bypass the "Add asset to CMDB". type: condition iscommand: false brand: "" nexttasks: '#default#': - "9" "yes": - "7" separatecontext: false conditions: - label: "yes" condition: - - operator: isEqualString left: value: complex: root: inputs.BypassAddRecord iscontext: true right: value: simple: "true" continueonerrortype: "" view: |- { "position": { "x": 900, "y": 1580 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "16": id: "16" taskid: caa5e8dc-a1cf-4bc1-861c-2a8f763f9304 type: condition task: id: caa5e8dc-a1cf-4bc1-861c-2a8f763f9304 version: -1 name: Is the CI a network adapter? description: Check if the returned CI is a network adapter. type: condition iscommand: false brand: "" nexttasks: '#default#': - "13" "yes": - "17" separatecontext: false conditions: - label: "yes" condition: - - operator: isEqualString left: value: complex: root: ServiceNowCMDB.Record.Attributes accessor: sys_class_name iscontext: true right: value: simple: cmdb_ci_network_adapter continueonerrortype: "" view: |- { "position": { "x": 450, "y": 1580 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false "17": id: "17" taskid: 0505c752-d13b-4ee6-851b-f1ee5cd5f2ab type: regular task: id: 0505c752-d13b-4ee6-851b-f1ee5cd5f2ab version: -1 name: Get record by ID and Network adapter CI description: Query attributes and relationship information for a specific record. script: ServiceNow CMDB|||servicenow-cmdb-record-get-by-id type: regular iscommand: true brand: ServiceNow CMDB nexttasks: '#none#': - "6" scriptarguments: class: simple: cmdb_ci_network_adapter sys_id: complex: root: ServiceNowCMDB.Records accessor: sys_id separatecontext: false continueonerrortype: "" view: |- { "position": { "x": 450, "y": 1810 } } note: false timertriggers: [] ignoreworker: false skipunavailable: false quietmode: 0 isoversize: false isautoswitchedtoquietmode: false view: |- { "linkLabelsPosition": { "14_7_#default#": 0.41, "9_7_No": 0.32 }, "paper": { "dimensions": { "height": 2025, "width": 1250, "x": 450, "y": 570 } } } inputs: - key: SearchCIClass value: simple: cmdb_ci required: false description: The CMDB CI class to perform the search on (Defaults to cmdb_ci). playbookInputQuery: - key: SearchQueryField value: simple: ip_address required: false description: The CI field used to perform the query (Defaults to ip_address). playbookInputQuery: - key: SearchQueryValue value: {} required: true description: The value used to perform the query. playbookInputQuery: - key: BypassAddRecord value: simple: "false" required: false description: Value to determine if the "add asset to CMDB" branch should be skipped in order to prevent direction to manual task. By default this is set to "false" but a "true" value will bypass. playbookInputQuery: outputs: - contextPath: ServiceNowCMDB.Record description: Discovered CI records type: unknown - contextPath: ServiceNowCMDB.Records description: A list of all the records that were found in the CMDB table. tests: - No tests (auto formatted) fromversion: 6.0.0 contentitemexportablefields: contentitemfields: {} supportedModules: - asm - exposure_management - agentix - xsiam