incident_info – List ServiceNow incidents

Retrieve information about ServiceNow incidents.

For more information, refer to the ServiceNow incident management documentation at https://docs.servicenow.com/bundle/paris-it-service-management/page/product/incident-management/concept/c_IncidentManagement.html.

New in version 1.0.0.

Examples

- name: Retrieve all incidents
  servicenow.itsm.incident_info:
  register: result

- name: Retrieve a specific incident by its sys_id
  servicenow.itsm.incident_info:
    sys_id: 471bfbc7a9fe198101e77a3e10e5d47f
  register: result

- name: Retrieve incidents by number
  servicenow.itsm.incident_info:
    number: INC0000039
  register: result

- name: Retrieve all incidents that contain SAP in its short description
  servicenow.itsm.incident_info:
    query:
      - short_description: LIKE SAP
  register: result

- name: Retrieve new incidents reported by abel.tuter or bertie.luby
  servicenow.itsm.incident_info:
    query:
      - state: = new
        caller: = abel.tuter
      - state: = new
        caller: = bertie.luby

See Also

See also

  • modules/servicenow.itsm.incident_module

Parameters

incident_mapping (optional)

User mapping for Incident object, where user can override Choice Lists values for objects.

type: dict
hold_reason (optional)

Reason why incident is on hold.

Required if state value is on_hold.

type: dict
impact (optional)

The measure of the business criticality of the affected service.

type: dict
state (optional)

State of the incident.

If state value is on_hold, on_hold_reason parameter must be filled in.

Special value that can not be overridden is absent, which would remove an incident from ServiceNow.

type: dict
urgency (optional)

The extent to which resolution of an incident can bear delay.

type: dict
instance (optional)

ServiceNow instance information.

type: dict
client_id (optional)

ID of the client application used for OAuth authentication.

If not set, the value of the SN_CLIENT_ID environment variable will be used.

If provided, it requires client_secret.

type: str
client_secret (optional)

Secret associated with client_id. Used for OAuth authentication.

If not set, the value of the SN_CLIENT_SECRET environment variable will be used.

If provided, it requires client_id.

type: str
grant_type (optional)

Grant type used for OAuth authentication.

If not set, the value of the SN_GRANT_TYPE environment variable will be used.

type: str
default: password
choices: password, refresh_token
host (required)

The ServiceNow host name.

If not set, the value of the SN_HOST environment variable will be used.

type: str
password (optional)

Password used for authentication.

If not set, the value of the SN_PASSWORD environment variable will be used.

Required when using basic authentication or when grant_type=password.

type: str
refresh_token (optional)

Refresh token used for OAuth authentication.

If not set, the value of the SN_REFRESH_TOKEN environment variable will be used.

Required when grant_type=refresh_token.

type: str
timeout (optional)

Timeout in seconds for the connection with the ServiceNow instance.

If not set, the value of the SN_TIMEOUT environment variable will be used.

type: float
username (optional)

Username used for authentication.

If not set, the value of the SN_USERNAME environment variable will be used.

Required when using basic authentication or when grant_type=password.

type: str
number (optional)

Number of the record to retrieve.

Note that contrary to sys_id, number may not uniquely identify a record.

type: str
query (optional)

Provides a set of operators for use with filters, condition builders, and encoded queries.

The data type of a field determines what operators are available for it. Refer to the ServiceNow Available Filters Queries documentation at https://docs.servicenow.com/bundle/quebec-platform-user-interface/page/use/common-ui-elements/reference/r_OpAvailableFiltersQueries.html.

type: list
sys_id (optional)

Unique identifier of the record to retrieve.

type: str

Return Values

records

A list of incident records.

sample:

- active: 'false'
  activity_due: ''
  additional_assignee_list: ''
  approval: not requested
  approval_history: ''
  approval_set: ''
  assigned_to: 5137153cc611227c000bbd1bd8cd2007
  assignment_group: 8a4dde73c6112278017a6a4baf547aa7
  attachments:
  - average_image_color: ''
    chunk_size_bytes: '700000'
    compressed: 'true'
    content_type: text/plain
    download_link: https://www.example.com/api/now/attachment/b7ad74d50706301022f9ffa08c1ed0ee/file
    file_name: sample_file1.txt
    hash: 6f2b0dec698566114435a23f15dcac848a40e1fd3e0eda4afe24a663dda23f2e
    image_height: ''
    image_width: ''
    size_bytes: '210'
    size_compressed: '206'
    state: pending
    sys_created_by: admin
    sys_created_on: '2021-08-17 11:19:24'
    sys_id: b7ad74d50706301022f9ffa08c1ed0ee
    sys_mod_count: '0'
    sys_tags: ''
    sys_updated_by: admin
    sys_updated_on: '2021-08-17 11:19:24'
    table_name: incident
    table_sys_id: efad74d50706301022f9ffa08c1ed06d
  business_duration: '1970-01-20 05:38:50'
  business_service: ''
  business_stc: '1661930'
  calendar_duration: '1970-03-21 20:38:50'
  calendar_stc: '6899930'
  caller_id: 681ccaf9c0a8016400b98a06818d57c7
  category: inquiry
  caused_by: ''
  child_incidents: ''
  close_code: Solved (Work Around)
  close_notes: Gave workaround
  closed_at: '2020-07-07 23:18:40'
  closed_by: 9ee1b13dc6112271007f9d0efdb69cd0
  cmdb_ci: ''
  comments: ''
  comments_and_work_notes: ''
  company: 31bea3d53790200044e0bfc8bcbe5dec
  contact_type: phone
  contract: ''
  correlation_display: ''
  correlation_id: ''
  delivery_plan: ''
  delivery_task: ''
  description: Noticing today that any time I send an email with an attachment, it
    takes at least 20 seconds to send.
  due_date: ''
  escalation: '0'
  expected_start: ''
  follow_up: ''
  group_list: ''
  hold_reason: ''
  impact: '1'
  incident_state: '7'
  knowledge: 'false'
  location: ''
  made_sla: 'false'
  notify: '1'
  number: INC0000013
  opened_at: '2020-07-06 23:15:58'
  opened_by: 9ee1b13dc6112271007f9d0efdb69cd0
  order: ''
  parent: ''
  parent_incident: ''
  priority: '1'
  problem_id: ''
  reassignment_count: '2'
  reopen_count: ''
  reopened_by: ''
  reopened_time: ''
  resolved_at: '2020-09-24 19:54:48'
  resolved_by: 6816f79cc0a8016401c5a33be04be441
  rfc: ''
  route_reason: ''
  service_offering: ''
  severity: '3'
  short_description: EMAIL is slow when an attachment is involved
  sla_due: ''
  state: '7'
  subcategory: ''
  sys_class_name: incident
  sys_created_by: don.goodliffe
  sys_created_on: '2020-07-07 23:18:07'
  sys_domain: global
  sys_domain_path: /
  sys_id: 46cebb88a9fe198101aee93734f9768b
  sys_mod_count: '5'
  sys_tags: ''
  sys_updated_by: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
  sys_updated_on: '2020-09-24 19:54:48'
  task_effective_number: INC0000013
  time_worked: ''
  universal_request: ''
  upon_approval: ''
  upon_reject: ''
  urgency: '1'
  user_input: ''
  watch_list: ''
  work_end: ''
  work_notes: ''
  work_notes_list: ''
  work_start: ''