Skip to content

fix: ServiceNow _notify_update now uses PATCH to actually update tickets#6177

Open
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/servicenow-update-uses-patch
Open

fix: ServiceNow _notify_update now uses PATCH to actually update tickets#6177
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/servicenow-update-uses-patch

Conversation

@DragonBot00
Copy link
Copy Markdown
Contributor

@DragonBot00 DragonBot00 commented Apr 1, 2026

Summary

Fixes two related ServiceNow provider bugs in _notify_update:

  1. Wrong HTTP method ([➕ Feature]: Do Real Updating Ticket in ServiceNowProvider #4949): Method was calling requests.get — it fetched the ticket but never modified it. Should be requests.patch.
  2. Auth logic inverted ([🐛 Bug]: ServiceNowProvider failed to update ticket #4948): if self._access_token was used where if not self._access_token was needed, causing 401 errors when using token auth.

Also fixed a typo: resp.raise_for_status()response.raise_for_status().

Closes #4949
Closes #4948

Changes

  • Replaced requests.get with requests.patch in _notify_update
  • Fixed auth condition: if self._access_tokenif not self._access_token
  • Added payload: dict = {} parameter so callers can pass update fields
  • Updated _notify to forward payload + remaining kwargs as the update body
  • Fixed variable name typo in error path
  • Added docstring

Usage example

- name: update-ticket
  provider:
    type: servicenow
    config: "{{ providers.servicenow }}"
  with:
    table_name: incident
    ticket_id: "{{ alert.ticket_id }}"
    fingerprint: "{{ alert.fingerprint }}"
    payload:
      state: "6"
      close_notes: "Resolved by Keep automation"

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Something isn't working Provider Providers related issues labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Provider Providers related issues size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Do Real Updating Ticket in ServiceNowProvider [🐛 Bug]: ServiceNowProvider failed to update ticket

1 participant