TransWikia.com

Unable to set custom field value on the chat transcript object from pre-chat using Embedded Service

Salesforce Asked by srmaind on December 28, 2020

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.

One Answer

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

Answered by vgeorge on December 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP