I am using chat (what was called live agent) and I am using the client side inside a Salesforce community - As explained here.
I am doing that with the Embedded Service Chat
component in the community builder
Now, for the pre-chat fields I want to override the standard behavior by using a javascript file in a static resource - exactly as explained here
This javascript file is supposed to override the pre-chat parameters defined in the Embedded Service Deployment Settings
PROBLEM
no matter what I am doing - it is not working, the override is not working and the Embedded Service Deployment Settings
is what I see in the pre-chat window.
REPRODUCE
1. Create javascript file:
window._snapinsSnippetSettingsFile = (function() {
console.log("Snippet settings file loaded."); // Logs that the snippet settings file was loaded successfully
embedded_svc.snippetSettingsFile.extraPrechatFormDetails = [{"label":"FirstName","value":"John","displayToAgent":true},
{"label":"LastName","value":"Doe","displayToAgent":true},
{"label":"Email","value":"[email protected]","displayToAgent":true}];
embedded_svc.snippetSettingsFile.extraPrechatInfo = [{
"entityName": "Contact",
"showOnCreate": true,
"linkToEntityName": "Case",
"linkToEntityField": "ContactId",
"saveToTranscript": "ContactId",
"entityFieldMaps" : [{
"doCreate":true,
"doFind":true,
"fieldName":"FirstName",
"isExactMatch":true,
"label":"First Name"
}, {
"doCreate":true,
"doFind":true,
"fieldName":"LastName",
"isExactMatch":true,
"label":"Last Name"
}, {
"doCreate":true,
"doFind":true,
"fieldName":"Email",
"isExactMatch":true,
"label":"Email"
}],
}, {
"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"
}]
}];
})();
2. Save file
with preChat.js
file name.
3. Upload file
upload the file as a static resource, name it chatEnhancedSettings
, also set the static resource as public
.
4. Use file in community
In the community builder, select the chat component to edit it's parameters, and in the Snippet Settings File
field enter: chatEnhancedSettings
.
5. Publish the community
Now for my it is not working.
QUESTIONS
Am I doing something wrong?
Maybe I am missing some steps to make it work?