In Snap-ins, When the offline chat option is enabled. The user initiate the chat and submit. So where does the case/chat is routed that is who is the case owner?
[SalesForce] In Snap-ins, when offline chat is enabled where does the chat is routed
Related Solutions
You have two options, or set the subject as required or prepopulate the field in the code.
embedded_svc.settings.extraPrechatFormDetails = [{
"label": "issue",
"value": "Subject Case",
"displayToAgent": true
}];
embedded_svc.settings.extraPrechatInfo = [{
"entityName": "Contact",
"showOnCreate": true,
"linkToEntityName": "Case",
"linkToEntityField": "ContactId",
"saveToTranscript": "ContactId",
"entityFieldMaps": [{
"isExactMatch": true,
"fieldName": "Email",
"doCreate": true,
"doFind": true,
"label": "Email"
}, {
"isExactMatch": true,
"fieldName": "AccountId",
"doCreate": true,
"doFind": true,
"label": "AccountId"
}]
}, {
"entityName": "Case",
"showOnCreate": true,
"saveToTranscript": "CaseId",
"entityFieldMaps": [{
"isExactMatch": false,
"fieldName": "Subject",
"doCreate": true,
"doFind": false,
"label": "issue"
}, {
"isExactMatch": false,
"fieldName": "Status",
"doCreate": true,
"doFind": false,
"label": "Status"
}, {
"isExactMatch": false,
"fieldName": "Origin",
"doCreate": true,
"doFind": false,
"label": "Origin"
}]
}]
Was able to use own buttons to activate chat.
Add styles to hide standard buttons:
.embeddedServiceHelpButton .helpButton .uiButton.helpButtonDisabled { display: none; } .embeddedServiceHelpButton .helpButton .uiButton.helpButtonEnabled { display: none; }
Add click listener to any chat buttons you want with class:
const chatHandler = function() { if (typeof (<any>window).embedded_svc !== 'undefined') { (<any>window).embedded_svc.onHelpButtonClick(); } }; const els = document.getElementsByClassName('chat-button'); Array.prototype.forEach.call(els, function(el) { el.addEventListener('click', chatHandler); });
For detecting online/offline status to change buttons style, I ended up using MutationObserver, creating a global observer for document looking for element with class embeddedServiceHelpButton and then creating an observer for any change in element with class helpButtonLabel. This element's text is changed by Salesforce Snap-ins when online/offline status changes.
Best Answer
It goes to Web to Case provided you've properly set it up and configured it properly. To learn more, I recommend you go through the Web Chat Basics Module on Trailhead. The Create Pre-Chat and Offline Support Forms section of that Module walks you through how to setup and configure offline support.
As to who will own the case, that will depend on how you configure Web to Case's Assignment Rules. Depending on Assignment Rules, it could go to either a Queue or a specific user.