Sunday 7 February 2021

How to pass values from Pre chat form fields to Chat Transcript Fields in Snap-In chat (Embedded Service Deployment )

 Hi ,

Here we are going to learn how can we map Pre-Chat form fields with Chat Transcript object fields when we enable chat with the help of "Snap-In (Embedded Service Deployment)".

When we want to map Pre-Chat form fields with "Chat Transcript" object fields we have to map 

Pre-Chat form field Label with "Chat Transcript" object Field Api Name as shown below under "embedded_svc.settings.extraPrechatFormDetails"

embedded_svc.settings.extraPrechatFormDetails = [{

          "label":"First Name",  

          "transcriptFields": ["FirstName__c"]

},{

          "label":"Last Name", 

          "transcriptFields": ["LastName__c"]

},{

          "label":"Email", 

          "transcriptFields": ["Email__c"]

},{

          "label":"Service Type", 

          "transcriptFields": ["Service Type__c"]

}];

Here "label" represents the label of field on Pre-Chat form and "transcriptFields" represents "Chat Transcript" field API Name to map or to store once chat initiated and chat transcript  record is created.

So in our case "First Name" from "Pre-Chat" form will be stored to "FirstName__c" field on Chat Transcript object ,"Last Name" from "Pre-Chat" form will be stored to "LastName__c" fied on Chat Transcript object etc.,

Note: We have to write the above snippet before "embedded_svc.init"

Reference:

https://help.salesforce.com/articleView?id=000349323&language=en_US&mode=1&type=1

https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_snippet_settings_file.htm



1 comment:

  1. thanks for the information. I've been searching this info anywhere but i couldn't find it.

    ReplyDelete

Best Practices for Building Prompt Templates

 Hi, The following best practices should be considered when building prompt templates: Make sure that your prompt templates are concise and ...