agent's servicenow update failed with "record not found": ticket merged mid-run
Makes a helpdesk agent survive ServiceNow ticket merges: re-resolving the ticket and following the merge target. Use when updates fail with record not found after a merge. Not for permission errors.
TL;DR
The ticket was merged into another while the agent worked, so its sys_id vanished. Catch record-not-found, search for the merge target, and continue the work on the surviving ticket.
The query
agent's servicenow update failed with "record not found": ticket merged mid-runUse this when
- agent updates fail with record not found
- the ticket was merged mid-run
- duplicate tickets get consolidated
Not for
- 403 permission errors
- deleted tickets
- API outages
Steps
- On record-not-found, search for the ticket number to find the merge target. Expected output: the surviving ticket is located.
- Verify the surviving ticket covers the same issue before continuing. Expected output: the match is confirmed.
- Re-anchor the agent state to the new sys_id. Expected output: subsequent actions target the right record.
- Note the merge in the work notes so humans see the trail. Expected output: the history is transparent.
- Add merge-awareness to the error handling so the next merge is automatic. Expected output: future merges do not fail the run.
Applies to
ServiceNow incident management, ticket merge, agent integrations via API.
Variant phrasings
Ticket deleted, not merged
Treat as a terminal state and notify; there is no target to follow.
Merge happened between read and write
Re-read before every write in long runs.
Why it happens
Merges are a normal ITSM operation, but agents hold stale references. Record-not-found is the signal to re-resolve, not to die.
Edge cases
- Two merges in a row are possible; loop the re-resolution with a cap.
- Work notes on the merged-away ticket are preserved on the target; check them.
- Alert when merges spike; it may indicate a duplicate-creation bug.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst0YdV5K6ckaRCs3ir6Sznw