Pass Nonstandard Pre-Chat Details

Further control the pre-chat experience using parameters in your Embedded Service 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.

The legacy chat product is in maintenance-only mode, and we won’t continue to build new features. You can continue to use it, but we no longer recommend that you implement new chat channels. Instead, you can modernize your customer communication with Messaging for In-App and Web. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time.

Important

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.

NameTypeDescription
labelStringThe label for this field.
valueStringThe value for this field.
displayToAgentBooleanWhether to display this label and value to the agent.
transcriptFieldsArray of StringsNames 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.

If the label name is the same in the pre-chat setup in your org and in the extraPrechatInfo parameter, the information in the extraPrechatInfo parameter takes precedence.

Important

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.

NameTypeDescription
entityNameStringThe type of record to search for or create.
entityFieldMapsArray of ObjectsThe list of fields within the record type specified in entityName.
entityFieldMaps.fieldNameStringThe name of the field.
entityFieldMaps.labelStringThe label of the field in the pre-chat form. This value must match the label in the extraPrechatFormDetails parameter.
entityFieldMaps.doCreateBooleanWhether to create if it doesn’t exist.
entityFieldMaps.doFindBooleanWhether to search for the field if not an exact match.
entityFieldMaps.isExactMatchBooleanWhether 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.
saveToTranscriptStringThe name of the transcript field to which to save the record. This field must 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.
linkToEntityNameStringThe 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.
linkToEntityFieldStringThe name of the field (within the related object specified in linkToEntityName) that you want to link this object to.

See Also