incident – Manage ServiceNow incidents

Create, delete or update a ServiceNow incident.

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: Create incident
  servicenow.itsm.incident:
    instance:
      host: https://instance_id.service-now.com
      username: user
      password: pass

    state: new
    caller: some.user
    short_description: User is not receiving email
    description: User has been unable to receive email for the past 15 minutes
    attachments:
      - path: path/to/attachment.txt
    impact: low
    urgency: low

    other:
      expected_start: 2021-02-12

- name: Change state of the incident
  servicenow.itsm.incident:
    instance:
      host: https://instance_id.service-now.com
      username: user
      password: pass

    state: in_progress
    number: INC0000001

- name: Close incident
  servicenow.itsm.incident:
    instance:
      host: https://instance_id.service-now.com
      username: user
      password: pass

    state: closed
    number: INC0000001
    close_code: "Solved (Permanently)"
    close_notes: "Closed"

- name: Delete incident
  servicenow.itsm.incident:
    instance:
      host: https://instance_id.service-now.com
      username: user
      password: pass

    state: absent
    number: INC0000001

Parameters

attachments (optional)

ServiceNow attachments.

type: list
name (optional)

Name of the file to be uploaded without the file extension.

If not specified, the module will use path’s base name.

type: str
path (required)

Path to the file to be uploaded.

type: str
type (optional)

MIME type of the file to be attached.

If not specified, the module will try to guess the file’s type from its extension.

type: str
caller (optional)

A person who reported or is affected by this incident.

Expected value for caller is user id (usually in the form of first_name.last_name).

Required if the incident does not exist yet.

type: str
close_code (optional)

Provide information on how the incident was resolved.

type: str
choices: Solved (Work Around), Solved (Permanently), Solved Remotely (Work Around), Solved Remotely (Permanently), Not Solved (Not Reproducible), Not Solved (Too Costly), Closed/Resolved by Caller
close_notes (optional)

Resolution notes added by the user who closed the incident.

type: str
description (optional)

Long description of the incident with some more details.

type: str
hold_reason (optional)

Reason why incident is on hold.

Required if state value is on_hold.

Default choices are awaiting_caller, awaiting_change, awaiting_problem, awaiting_vendor. One can override them by setting incident_mapping.hold_reason.

type: str
impact (optional)

The measure of the business criticality of the affected service.

Default choices are low, medium, high. One can override them by setting incident_mapping.impact.

type: str
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 operate on.

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

type: str
other (optional)

Optional remaining parameters.

For more information on optional parameters, refer to the ServiceNow create incident documentation at https://docs.servicenow.com/bundle/paris-it-service-management/page/product/incident-management/task/create-an-incident.html.

type: dict
short_description (optional)

Short description of the incident.

Required if the incident does not exist yet.

type: str
state (optional)

State of incident.

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

Default choices are new, in_progress, on_hold, resolved, closed, canceled, absent. One can override them by setting incident_mapping.state.

type: str
sys_id (optional)

Unique identifier of the record to operate on.

type: str
urgency (optional)

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

Default choices are low, medium, high. One can override them by setting incident_mapping.urgency.

type: str