problem – Manage ServiceNow problems

Create, delete or update a ServiceNow problem.

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

New in version 1.0.0.

Examples

- name: Create a problem
  servicenow.itsm.problem:
    state: new
    short_description: Issue with the network printer
    description: Since this morning, all printer jobs are stuck.
    attachments:
      - path: path/to/attachment.txt
    impact: medium
    urgency: low
    other:
      user_input: notes

- name: Assign a problem to a user for assessment
  servicenow.itsm.problem:
    number: PRB0000010
    state: assess
    assigned_to: problem.manager

- name: Mark a problem for root cause analysis
  servicenow.itsm.problem:
    number: PRB0000010
    state: root_cause_analysis

- name: Work on fixing a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: fix_in_progress
    cause_notes: I identified the issue.
    fix_notes: Fix here.


- name: Close a problem as fixed
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: fix_applied
    cause_notes: I found that this doesn't work.
    fix_notes: I solved it like this.

- name: Close a problem as duplicate
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: duplicate
    duplicate_of: PRB0000001

- name: Cancel a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: closed
    resolution_code: canceled
    close_notes: The problem seems to have resolved itself.

- name: Delete a problem
  servicenow.itsm.problem:
    number: PRB0000010
    state: absent

See Also

See also

  • modules/servicenow.itsm.problem_info_module

  • modules/servicenow.itsm.problem_task_module

  • modules/servicenow.itsm.problem_task_info_module

Parameters

assigned_to (optional)

A person who will assess this problem.

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

This field is required when creating new problems for all problem *state*s except new.

type: str
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
cause_notes (optional)

Provide information on what caused the problem.

Required if state is in_progress.

Required if state is resolved or closed and resolution_code is fix_applied or risk_accepted.

type: str
close_notes (optional)

The reason for closing the problem.

Required if state is resolved or closed and resolution_code is risk_accepted or canceled.

type: str
description (optional)

Detailed description of the problem.

type: str
duplicate_of (optional)

Number of the problem of which this problem is a duplicate of.

Required if state is resolved or closed and resolution_code is duplicate.

type: str
fix_notes (optional)

Notes on how the problem was fixed.

Required if state is in_progress.

Required if state is resolved or closed and resolution_code is fix_applied.

type: str
impact (optional)

Effect that the problem has on business.

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

type: str
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 documentation on creating problems at https://docs.servicenow.com/bundle/paris-it-service-management/page/product/problem-management/task/create-a-problem-v2.html.

type: dict
problem_mapping (optional)

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

type: dict
impact (optional)

Effect that the problem has on business.

type: dict
problem_state (optional)

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

This mapping can also be edited inside Choice Lists inside ServiceNow and can differ from state mapping.

type: dict
state (optional)

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

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

type: dict
urgency (optional)

The extent to which the problem resolution can bear delay.

type: dict
resolution_code (optional)

The reason for problem resolution.

type: str
choices: fix_applied, risk_accepted, duplicate, canceled
short_description (optional)

Short description of the problem that the problem-solving team should address.

Required if the problem does not exist yet.

type: str
state (optional)

State of the problem.

If a problem does not yet exist, all states except for new require setting of assigned_to parameter.

Default choices are new, assess, root_cause_analysis, fix_in_progress, resolved, closed, absent. One can override them by setting problem_mapping.state.

type: str
sys_id (optional)

Unique identifier of the record to operate on.

type: str
urgency (optional)

The extent to which the problem resolution can bear delay.

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

type: str

Return Values

record

The problem record.

sample:

active: 'true'
activity_due: ''
additional_assignee_list: ''
approval: not requested
approval_history: ''
approval_set: ''
assigned_to: 73ab3f173b331300ad3cc9bb34efc4df
assignment_group: ''
attachments:
- average_image_color: ''
  chunk_size_bytes: '700000'
  compressed: 'true'
  content_type: text/plain
  download_link: https://www.example.com/api/now/attachment/31cdf4d50706301022f9ffa08c1ed07f/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:49'
  sys_id: 31cdf4d50706301022f9ffa08c1ed07f
  sys_mod_count: '0'
  sys_tags: ''
  sys_updated_by: admin
  sys_updated_on: '2021-08-17 11:19:49'
  table_name: problem
  table_sys_id: 6dcdb4d50706301022f9ffa08c1ed0fb
business_duration: ''
business_service: ''
calendar_duration: ''
category: software
cause_notes: ''
close_notes: ''
closed_at: ''
closed_by: ''
cmdb_ci: 27d32778c0a8000b00db970eeaa60f16
comments: ''
comments_and_work_notes: ''
company: ''
confirmed_at: ''
confirmed_by: ''
contact_type: ''
contract: ''
correlation_display: ''
correlation_id: ''
delivery_plan: ''
delivery_task: ''
description: Unable to send or receive emails.
due_date: ''
duplicate_of: ''
escalation: '0'
expected_start: ''
first_reported_by_task: ''
fix_communicated_at: ''
fix_communicated_by: ''
fix_notes: ''
follow_up: ''
group_list: ''
impact: low
knowledge: 'false'
known_error: 'false'
location: ''
made_sla: 'true'
major_problem: 'false'
number: PRB0007601
opened_at: '2018-08-30 08:08:39'
opened_by: 6816f79cc0a8016401c5a33be04be441
order: ''
parent: ''
priority: '5'
problem_state: new
reassignment_count: '0'
related_incidents: '0'
reopen_count: '0'
reopened_at: ''
reopened_by: ''
resolution_code: ''
resolved_at: ''
resolved_by: ''
review_outcome: ''
rfc: ''
route_reason: ''
service_offering: ''
short_description: Unable to send or receive emails.
sla_due: ''
state: new
subcategory: email
sys_class_name: problem
sys_created_by: admin
sys_created_on: '2018-08-30 08:09:05'
sys_domain: global
sys_domain_path: /
sys_id: 62304320731823002728660c4cf6a7e8
sys_mod_count: '1'
sys_tags: ''
sys_updated_by: admin
sys_updated_on: '2018-12-12 07:16:57'
task_effective_number: PRB0007601
time_worked: ''
universal_request: ''
upon_approval: proceed
upon_reject: cancel
urgency: low
user_input: ''
watch_list: ''
work_end: ''
work_notes: ''
work_notes_list: ''
work_start: ''
workaround: ''
workaround_applied: 'false'
workaround_communicated_at: ''
workaround_communicated_by: ''