Newer Version Available
Step 4: Create AgentWork
Your partner application needs to create AgentWork in order to
route the work to an agent in Omni-Channel.
When the external routing implementation receives new PendingServiceRouting creation events (with the routing type external), it uses the standard Salesforce SOAP API to fetch further information based on the PendingServiceRouting.It makes a routing decision by creating new AgentWork records. This is existing functionality that partners use to query Salesforce.
Reference the following code sample to create AgentWork using
Java.
1AgentWork work = new AgentWork();
2work.setServiceChannelId(objectFactory.createAgentWorkServiceChannelId(request.getServiceChannelId()));
3work.setWorkItemId(objectFactory.createAgentWorkWorkItemId(request.getEntityId()));
4work.setUserId(objectFactory.createAgentWorkUserId(userId));
5Create create = new Create();
6create.getSObjects().add(work);
7CreateResponse createResult = (CreateResponse) getWebServiceTemplate().marshalSendAndReceive(create, new AuthenticationHeader(header));