1

I am using an embedded service deployment to show a chat window on a publicly hosted webpage. This chat has a pre-chat form configured where I take in the contact details. I want to input some additional fields like subject and message from the user and store it in a custom field on the LiveChatTranscript Object record. The reason I am using a custom field instead of storing it directly on the Case is so that I can decide from the subject if there is an existing case that I should attach to the chat, or should I create a new Case.

Here is the code I am using for storing custom field Subject:

embedded_svc.snippetSettingsFile.extraPrechatFormDetails = [
    {
        "label": "Case Subject",
        "transcriptFields": ["CaseSubject__c"],
        "displayToAgent":true
    }
];

Even after adding this code, I am just seeing the FirstName, LastName, and Email fields which I have configured in the Pre-chat page and not this additional subject field.

I also need to confirm where actually we need to write this code and if I am missing anything.

1
  • 1
    did you managed to figure this out? I have a similar issue, the settings js don't work at all.
    – mascot
    Commented Oct 7, 2020 at 19:20

2 Answers 2

1

You would have to update the "value" attribute for the field like below

embedded_svc.snippetSettingsFile.extraPrechatFormDetails = [
{
    "label": "Case Subject",
    "transcriptFields": ["CaseSubject__c"],
    "displayToAgent":true,
    "value": "Subject for the case"
}];

It's the value attribute that is mapped to the field

0

May be this link can help.

https://help.salesforce.com/s/articleView?id=000349323&type=1

small Extract from the link:

If you want to save dynamic values from the pre-chat form directly into a custom field in the transcript object.

  • Create a custom field on the transcript object (for example, PrechatText__c).

  • Pass the transcript fields in the extra pre-chat form details without passing the value property.

    embedded_svc.settings.extraPrechatFormDetails = [{"label":"Text", "transcriptFields": ["PrechatText__c"]}];

....

You must log in to answer this question.

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