Calling closeAgentWork on lightning:omniToolkitAPI for Omni chats doesn't properly end chat.
Live Agent , Lightning , Omni-Channel
Last updated 2019-09-07 ·Reference W-5518666 ·Reported By 4 users
Summary
In LEX console, if a customer has implemented a customization to call closeAgentWork from the lightning omniToolkitAPI on Omni chats, the chat is not ended, though the AgentWork is closed. Furthermore, while the chat has not ended, errors pop up when the agent tries to send messages or end the chat, and the chasitor's messages don't reach the agent. The console tab for the chat can't be closed either.
Repro
>> Create an org with LA and Omni enabled.
>> Create a test Omni chat button that a test agent can accept.
>> Enable Lightning and create a Lightning console.
>> Create a lightning component with this sample code:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<lightning:omniToolkitAPI aura:id="omniToolkit" />
<lightning:button label="Close" onclick="{! c.closeWork }" />
</aura:component>
>> Add this code to the component's controller:
({
closeWork: function(cmp, evt, hlp) {
var omniAPI = cmp.find("omniToolkit");
omniAPI.getAgentWorks().then(function(result) {
var works = JSON.parse(result.works);
var work = works[0];
omniAPI.closeAgentWork({workId: work.workId}).then(function(res) {
if (res) {
console.log("Closed work successfully");
} else {
console.log("Close work failed");
}
}).catch(function(error) {
console.log(error);
});
});
}
})
>> Add the lightning component to the lightning page for chat transcripts.
>> Submit a test chat and confirm messages can send back and forth.
>> Click the Close button in the custom lightning component.
>> Now when you try to send messages or end the chat, an error will present to the agent.
>> No chat messages from the chasitor will reach the agent either (though you can see them come through the Network tab, they're just not presenting on the UI).
>> Trying to close the console tab also won't work.
Workaround
None. There doesn't appear to be any way to end the chat programmatically (there are methods in the classic console that aren't available here).
Reported By (4)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.