How to save the custom detail to a custom field on Chat Transcript object(LiveChatTranscript) in Salesforce?

How to save the custom detail to a custom field on Chat Transcript object(LiveChatTranscript) in Salesforce?

Chat Transcript object have several standard fields. For Example, Chat Button in Chat Transcript object stores the chat button id that the visitor clicked to initiate the chat.
Reference Link:
https://help.salesforce.com/articleView?id=live_agent_transcript_fields.htm&type=5

To save the custom detail to a custom field on LiveChatTranscript at the end of a chat, use the below
liveagent.addCustomDetail().saveToTranscript()

Example:
liveagent.addCustomDetail( ‘Company’, ‘Acme’ ).saveToTranscript( ‘Company__c’ );
Here Company__c is a custom field in Chat Transcript Object.

Sample Code:
<script type=’text/javascript’>
var test = liveagent.addCustomDetail( ‘Example’, ‘Example Value’ ).saveToTranscript( ‘Source__c’ );
</script>
 

Leave a Reply