Update an AgentWork Record
Updates an AgentWork record.
For Bring Your Own Channel for Contact Center as a Service, this API cancels an AgentWork record for a rep before the conversation is assigned to another user, such as a supervisor or another rep.
This API applies to the following products:
- Bring Your Own Channel for Contact Center as a Service
This API is available in version 64.0 and later.
For Bring Your Own Channel for Contact Center as a Service, use this API to cancel an AgentWork record when a rep doesn’t accept or decline the work, and before a second AgentWork record is created for another user to handle the work.
In Salesforce, AgentWork records track and manage conversations as they’re routed. Each record contains information about the conversation’s routing details, including its routing status and the user assigned to the work. If the assigned user doesn’t accept or decline the work, reassign the work to another user.
To reassign the work to another user:
- Call this API to cancel the first AgentWork record.
- Call
POST /v1/agentWorkto create a new AgentWork record and assign it to another user.
If you don’t cancel the first AgentWork record before creating the second one, the first record remains assigned and visible to the first user who can still accept the work. If the first and second user accept the work, they will both be in the conversation simultaneously.
You can use this API to cancel AgentWork records that are assigned to but not yet accepted or declined by the user. If you try to cancel unassigned AgentWork records or assigned AgentWork records that have already been accepted or declined by the user, an error message is returned stating that the AgentWork record isn’t in a state that can be cancelled.
v1/agentWork
PATCH
Format: Bearer <Salesforce Access Token>
String. Standard header. Used to authenticate the user, where <Salesforce Access Token> is the Salesforce access token used as the bearer token to make requests to the Interaction Service APIs. Required.
Format: application/json
String. Standard header. Format of the request payload. Required for any request that includes a body.
Format: <Salesforce Org ID>
String. Custom header. The Salesforce org. <Salesforce Org ID> is the 15-character Org ID of the Salesforce org. Required.
Format: <UUID>
String. Custom header. Universally Unique Identifier (<UUID>) that references and tracks this request. Required.
Format: <AuthorizationContext>
String. Custom header. Additional information for the request authorization used to authenticate and validate requests against the connected app scopes.
- For Bring Your Own Channel for CCaaS, set
<AuthorizationContext>to the developer name of the ConversationChannelDefinition record. For example, Partner1_ChannelDefinition1. Required.
| Property Name | Type | Description | Required |
|---|---|---|---|
| workId | string | Salesforce 15-character AgentWork record ID. | Yes |
| status | string | Status of the AgentWork record. For Bring Your Own Channel for Contact Center as a Service, set this value to Cancel to cancel the AgentWork record. You can only cancel AgentWork records that are assigned to but not yet accepted or declined by the user. If the AgentWork record is unassigned or the rep has already accepted or declined the AgentWork record, setting this value to Cancel returns an error message stating that the AgentWork record isn’t in a state that can be cancelled. | Yes |
| contextType | string | Target participant type this AgentWork record update applies to. For Bring Your Own Channel for Contact Center as a Service, set this value to Agent (representing a rep). If set to Agent, also set Status to Cancel. | Yes |
Request to cancel an AgentWork record if a rep doesn’t accept the conversation:
- Create an AgentWork Record
- GitHub: Interaction Service APIs
- Object Reference: AgentWork
- Salesforce Help: Route Work with Omni-Channel