- Gets multiple records from a specified table from ServiceNow based on a query dictionary.
- python pysnow (pysnow)
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
table |
Default: incident |
Table to query for records. | |
max_records |
Default: 20 |
Maximum number of records to return. | |
return_fields |
Fields of the record to return in the json. By default, all fields will be returned. | ||
order_by |
Default: -created_on |
Field to sort the results on. Can prefix with "-" or "+" to change descending or ascending sort order. | |
query required |
Dict to query for records. |
- name: Search for incident assigned to group, return specific fields
snow_record_find:
username: ansible_test
password: my_password
instance: dev99999
table: incident
query:
assignment_group: d625dccec0a8016700a222a0f7900d06
return_fields:
- number
- opened_at
- name: Search for incident using host instead of instance
snow_record_find:
username: ansible_test
password: my_password
host: dev99999.mycustom.domain.com
table: incident
query:
assignment_group: d625dccec0a8016700a222a0f7900d06
return_fields:
- number
- opened_at
- name: Using OAuth, search for incident assigned to group, return specific fields
snow_record_find:
username: ansible_test
password: my_password
client_id: "1234567890abcdef1234567890abcdef"
client_secret: "Password1!"
instance: dev99999
table: incident
query:
assignment_group: d625dccec0a8016700a222a0f7900d06
return_fields:
- number
- opened_at
- name: Find open standard changes with my template
snow_record_find:
username: ansible_test
password: my_password
instance: dev99999
table: change_request
query:
AND:
equals:
active: "True"
type: "standard"
u_change_stage: "80"
contains:
u_template: "MY-Template"
return_fields:
- sys_id
- number
- sys_created_on
- sys_updated_on
- u_template
- active
- type
- u_change_stage
- sys_created_by
- description
- short_description