Service Now Service Now: Incidents

Summary

This module contains actions related to ServiceNow Incidents.

Actions

service_now.incidents.

choose_close_code

Get valid incident close codes from ServiceNow & allow the Task Operator to choose one.

Minimum Plugin Version: 2.1.0

Input
Output

The chosen close code as a string.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- service_now.incidents.choose_close_code:
  load:
    access_details: service_now_api_info
  save: chosen_close_code

- service_now.incidents.update:
  load:
    sys_id: incident.sys_id
    close_code: chosen_close_code
    access_details: service_now_api_info

service_now.incidents.

choose_priority

Get valid incident priorities from ServiceNow & allow the Task Operator to choose one.

Minimum Plugin Version: 3.0.0

Input
Output

A dictionary containing the name & value for the chosen priority.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- service_now.incidents.choose_priority:
  load:
    access_details: service_now_api_info
  save: chosen_priority

- service_now.incidents.update:
  load:
    sys_id: incident.sys_id
    priority: chosen_priority
    access_details: service_now_api_info

service_now.incidents.

choose_state

Get valid incident statuses from ServiceNow & allow the Task Operator to choose one.

Minimum Plugin Version: 3.0.0

??? info "Input"

 - __access_details:__ an [AccessDetails Dictionary](../inputs_outputs/#accessdetails)

??? success "Output"

A dictionary containing the name & value for the chosen state.

??? example

 ```YAML linenums="1"
 - service_now.incidents.choose_state:
   load:
     access_details: service_now_api_info
   save: chosen_state

 - service_now.incidents.update:
   load:
     sys_id: incident.sys_id
     state: chosen_state
     access_details: service_now_api_info
 ```

service_now.incidents.

get_by_number

Get an incident by its number.

Minimum Plugin Version: 4.0.0

Input
Output

A single Incident Dictionary.

Incident Numbers

ServiceNow incident numbers are not unique by default, but for simplicity this action assumes they are.

If you do have shared incident numbers, you can use the search action to get multiples.

Example
1
2
3
4
5
- service_now.incidents.get_by_number:
    number: TEST-INCIDENT
  load:
    access_details: service_now_api_info
  save: test_incident

service_now.incidents.

get_by_number_interactive

Interactively search for an incident using the number field.

Minimum Plugin Version: 1.0.0

Input
Output

An Incident Dictionary.

Example
1
2
3
4
- service_now.incidents.get_by_number_interactive:
  load:
    access_details: service_now_api_info
  save: incident

service_now.incidents.

get_valid_close_codes

Get valid incident close codes from the ServiceNow configuration.

Minimum Plugin Version: 3.0.0

Input
Output

A list of close codes in the following format:

1
2
3
4
5
6
7
- Solved (Work Around)
- Solved (Permanently)
- Solved Remotely (Work Around)
- Solved Remotely (Permanently)
- Not Solved (Not Reproducible)
- Not Solved (Too Costly)
- Closed/Resolved by Caller
Example
1
2
3
4
- service_now.incidents.get_valid_close_codes:
  load:
    access_details: service_now_api_info
  save: valid_close_codes

service_now.incidents.

get_valid_priorities

Get valid incident priorities from the ServiceNow configuration.

Minimum Plugin Version: 3.0.0

Input
Output

A dictionary of priorities in the following format:

1
2
3
4
5
1 - Critical: 1
2 - High: 2
3 - Moderate: 3
4 - Low: 4
5 - Planning: 5
Example
1
2
3
4
- service_now.incidents.get_valid_priorities:
  load:
    access_details: service_now_api_info
  save: valid_priorities

service_now.incidents.

get_valid_states

Get valid incident states from the ServiceNow configuration.

Minimum Plugin Version: 3.0.0

Input
Output

A dictionary of states in the following format:

1
2
3
4
5
6
New: 1
In Progress: 2
On Hold: 3
Resolved: 6
Closed: 7
Canceled: 8
Example
1
2
3
4
- service_now.incidents.get_valid_states:
  load:
    access_details: service_now_api_info
  save: valid_states

service_now.incidents.

input_table

Display a list of incidents in a table, & allow the task operator to make a selection.

The table will have the following columns:

  • Number
  • Short Description
  • State
  • Assigned To
  • Active

Minimum Plugin Version: 3.0.0

Input
  • text: The title of the table

  • incident_list: A list of Incident Dictionaries to display in the table

  • minimum: The minimum number of acceptable selections

  • maximum: The maximum number of acceptable selections

Output

A list of Incident Dictionaries.

Tip
  • If neither a minimum or maximum is provided, the task operator will be able to submit 0 selections.
  • If minimum or maximum are provided, the operation will repeat until the task operator makes a valid number of selections.
Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
- service_now.incidents.search:
  load:
    access_details: service_now_api_info
  save: incidents

- service_now.incidents.input_table:
    text: Please Select 1 Incident
    minimum: 1
    maximum: 1
  load:
    incident_list: incidents
  save: incident

service_now.incidents.

output_table

Display a list of incidents in a table.

The table will have the following columns:

  • Number
  • Short Description
  • State
  • Assigned To
  • Active

Minimum Plugin Version: 2.0.0

Input
Output

Nothing is outputted by this action.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
- service_now.users.search:
    user_name: john.smith
  load:
    access_details: service_now_api_info
  save: users

- ppa_tools.lists.get_first_item:
  load:
    items: users
  save: user

- service_now.incidents.search:
  load:
    assigned_to: user.sys_id
    access_details: service_now_api_info
  save: user_incidents

- service_now.incidents.output_table:
    text: Incidents for {{ user.user_name }}
  load:
    incident_list: user_incidents

service_now.incidents.

Search for incidents. Supports multiple search fields and values.

Advanced search techniques & filters are not supported yet.

Each supplied field & value will be converted to field=value in the search query.

Minimum Plugin Version: 2.0.0

Input
Output

A list of Incident Dictionaries.

Example

Searching for all active incidents.

1
2
3
4
5
- service_now.incidents.search:
    active: true
  load:
    access_details: service_now_api_info
  save: active_incidents

service_now.incidents.

update

Update an incident using one or more sets of fields & values

Minimum Plugin Version: 1.0.0

Input
Output

The updated incident as an Incident Dictionary.

Example

Resolving a incident TEST-INCIDENT with a comment and note.

1
2
3
4
5
6
7
8
9
- service_now.incidents.update:
    number: TEST-INCIDENT
    state: 6
    close_notes: Resolved via PPA
    comment: Resolving an incident from a PPA task
  load:
    access_details: service_now_api_info
    sys_id: incident.sys_id
  save: resolved_incident