Newer Version Available
Pass Nonstandard Pre-Chat Details
Further control the pre-chat experience using parameters in your Snap-ins
code snippet. Two parameters relate to the pre-chat experience: extraPrechatFormDetails and extraPrechatInfo. With these parameters, you can send information to the agent and
to your org beyond what’s shown on the pre-chat form.
extraPrechatFormDetails
This parameter allows you to send the agent more information and add information to the chat transcript.
The following sample code illustrates the most common fields for extraPrechatFormDetails.
1embedded_svc.settings.extraPrechatFormDetails = [{
2 "label": "First Name",
3 "value": "John",
4 "displayToAgent": true
5}, {
6 "label": "Last Name",
7 "value": "Doe",
8 "displayToAgent": true
9}, {
10 "label": "Email",
11 "value": "john.doe@salesforce.com",
12 "displayToAgent": true
13}];The following properties can be used in this JSON parameter.
| Name | Type | Description |
|---|---|---|
| label | String | The label for this field. |
| value | String | The value for this field. |
| displayToAgent | Boolean | Whether to display this label and value to the agent. |
| transcriptFields | Array of Strings | Names of the fields on the chat transcript record to which to save this value. |
extraPrechatInfo
This parameter lets you map the pre-chat form details from the extraPrechatFormDetails parameter to fields in existing or new records. The information in this parameter is merged with the information already specified from your org's setup.
The following sample code illustrates the most common fields for extraPrechatInfo.
1embedded_svc.settings.extraPrechatInfo = [{
2 "entityFieldMaps": [{
3 "doCreate": false,
4 "doFind": true,
5 "fieldName": "LastName",
6 "isExactMatch": true,
7 "label": "Last Name"
8 }, {
9 "doCreate": false,
10 "doFind": true,
11 "fieldName": "Email",
12 "isExactMatch": true,
13 "label": "Email"
14 }],
15 "entityName": "Contact"
16}];The following properties can be used in this JSON parameter.
| Name | Type | Description |
|---|---|---|
| entityName | String | The type of record to search for or create. |
| entityFieldMaps | Array of Objects | The list of fields within the record type specified in entityName. |
| entityFieldMaps.fieldName | String | The name of the field. |
| entityFieldMaps.label | String | The label of the field in the pre-chat form. This value must match the label in the extraPrechatFormDetails parameter. |
| entityFieldMaps.doCreate | Boolean | Whether to create if it doesn't exist. |
| entityFieldMaps.doFind | Boolean | Whether to search for the field if not an exact match. |
| entityFieldMaps.isExactMatch | Boolean | Whether a field value must match the field value in an existing record when you conduct a search with the findOrCreate.map API method. See findOrCreate.map.isExactMatch in the Live Agent Developer Guide. |
| saveToTranscript | String | The name of the transcript field to which to save the record. This field needs to be a standard lookup field or a custom field with a lookup relationship. If you don’t want to attach contact records to the transcript, set saveToTranscript to an empty string. |
| linkToEntityName | String | The name of the related object you want to link this object to. If you don’t want the default link between a contact and a case, set linkToEntityName to an empty string. |
| linkToEntityField | String | The name of the field (within the related object specified in linkToEntityName) that you want to link this object to. |