0

Hello I'm developing a Live Chat using the Service Setup "Chat with Customers" wizard.

I'm using extraPrechatInfo to hardcode the country of the page I'm embedding the chat button into so that the Case is generated with the custom country field populated. E.G.: If the website is example.com/uk/ the code works like this:

        embedded_svc.settings.extraPrechatFormDetails = [{
            "label": "Country",
            "value": "UK",
            "displayToAgent": false
        }];
        
        
        embedded_svc.settings.extraPrechatInfo = [{
            "entityName": "Case",
            "showOnCreate": true,
            "entityFieldMaps": [
                {
                    "doCreate": true,
                    "doFind": false,
                    "fieldName": "Country__c",
                    "isExactMatch": false,
                    "label": "Country"
                }]
        }];

I also need this logic to work when the agents are offline and the offline form generates the case without chatting. How can I pass the country value to the custom case field in the offline form without requiring the user to insert it?

1 Answer 1

1

One solution I found is to set the field and the value I want in the Offline Case Quick Action like so:

<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
    <description>Snapins_Case_OfflineCaseQuickAction_08h5t00000000IV_1693989448458</description>
    <fieldOverrides>
        <field>Country__c</field>
        <formula>&apos;UK&apos;</formula>
    </fieldOverrides>
    Rest of metadata here...

enter image description here

Since I had multiple deployments I searched for the correct quick action by looking in the deployment metadata under the quickActionDefinition tag for quickActionType = OfflineCase :

<EmbeddedServiceLiveAgent xmlns="http://soap.sforce.com/2006/04/metadata">
    <embeddedServiceConfig>Chat_Agents_UK</embeddedServiceConfig>
    <embeddedServiceQuickActions>
        <embeddedServiceLiveAgent>Chat_Agents_UK</embeddedServiceLiveAgent>
        <order>1</order>
        <quickActionDefinition>Snapins_Case_OfflineCaseQuickAction_08h5t00000000IV_1693989448458</quickActionDefinition>
        <quickActionType>OfflineCase</quickActionType>
    </embeddedServiceQuickActions>
    Rest of metadata here...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .