Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed auto closing tickets in service now #31194

Merged
merged 12 commits into from
Dec 17, 2023
8 changes: 6 additions & 2 deletions Packs/ServiceNow/Integrations/ServiceNowv2/ServiceNowv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2592,12 +2592,14 @@ def update_remote_system_command(client: Client, args: dict[str, Any], params: d
ticket_type = client.ticket_type
ticket_id = parsed_args.remote_incident_id
closure_case = get_closure_case(params)
demisto.debug(f"closure case= {closure_case}")
is_custom_close = False
close_custom_state = params.get('close_custom_state', None)

demisto.debug(f"state will change to= {parsed_args.data.get('state')}")
if parsed_args.incident_changed:
demisto.debug(f'Incident changed: {parsed_args.incident_changed}')
if parsed_args.inc_status == IncidentStatus.DONE:
demisto.debug('Closing incident by closure case')
if closure_case and ticket_type in {'sc_task', 'sc_req_item', SIR_INCIDENT}:
parsed_args.data['state'] = '3'
# These ticket types are closed by changing their state.
Expand All @@ -2611,11 +2613,13 @@ def update_remote_system_command(client: Client, args: dict[str, Any], params: d
parsed_args.data['state'] = close_custom_state

fields = get_ticket_fields(parsed_args.data, ticket_type=ticket_type)
demisto.debug(f"all fields= {fields}")
if closure_case:
# Convert the closing state to the right one if the ticket type is not incident in order to close the
# ticket/incident via XSOAR
if ticket_type in {'sc_task', 'sc_req_item', SIR_INCIDENT} and not is_custom_close:
if parsed_args.data.get('state') == '7 - Closed' and not is_custom_close:
fields['state'] = TICKET_TYPE_TO_CLOSED_STATE[ticket_type]

fields = {key: val for key, val in fields.items() if key != 'closed_at' and key != 'resolved_at'}

demisto.debug(f'Sending update request to server {ticket_type}, {ticket_id}, {fields}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ script:
- contextPath: ServiceNow.Generic.Response
description: Generic response to servicenow api.
type: string
dockerimage: demisto/python3:3.10.13.80014
dockerimage: demisto/python3:3.10.13.83255
isfetch: true
ismappable: true
isremotesyncin: true
Expand Down
7 changes: 7 additions & 0 deletions Packs/ServiceNow/ReleaseNotes/2_5_48.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#### Integrations

##### ServiceNow v2
- Updated the Docker image to: *demisto/python3:3.10.13.83255*.

- Fixed an issue with the outgoing mirroring functionality where newly created tickets were incorrectly closed.
4 changes: 2 additions & 2 deletions Packs/ServiceNow/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ServiceNow",
"description": "Use The ServiceNow IT Service Management (ITSM) solution to modernize the way you manage and deliver services to your users.",
"support": "xsoar",
"currentVersion": "2.5.47",
"currentVersion": "2.5.48",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand All @@ -18,4 +18,4 @@
"marketplacev2",
"xpanse"
]
}
}