Pre-Chat Form Setup in Salesforce Live Agent

March 23, 2017 Appirio

Salesforce Live Agent allows you to connect with customers in real time through a web-based, text-only live chat. To initiate text-only live chat, a pre-chat form is a useful feature.

A pre-chat form is used to gather basic information from customers, like name, email, phone number, and reason for contacting the agent — all of which will help in redirecting the customer to the right agent in minimal time. To gather more information, if required, you can customize the pre-chat form using a VisualForce page.

You can create custom fields in the Standard Live Agent object, which can then be mapped using the pre-chat form and will be visible to the agent on the hover pop-up during the incoming chat. The format to map custom fields is:

name=”liveagent.pre chat:.

If you don’t want to show any custom detail on the page, you can hide it using this statement:

<input type=”hidden” name=”” value=”Custom_Field__c”/>

Once you have completed the setup, you will need to map those details to Salesforce. You can only create a single mapping for each object. In each mapping, you need to specify the Salesforce object’s field name and custom detail name, and you can separate each pair with a semicolon.

This is how you can create a text box for input email:

<input type=”text” name=”liveagent.prechat:contactFirstName” />

<input type=”text” name=”liveagent.prechat:contactLastName” />

<input type=”text” name=”liveagent.prechat:contactEmail” />

<input type=”hidden” name=”liveagent.prechat:SessionId” id=”prechat_field_session_id” value=”” />

This is how you can map this detail to Salesforce:

<input type=”hidden” name=”” value=”FirstName,contactFirstName;LastName,contactLastName;Email,contactEmail;Session_Id__c,SessionId” />

The next step is to determine whether you want to perform a search on the existing records in Salesforce. You can do this by using doFind. You can also specify if you want an exact match or a partial match for the search string. This will search on Contact records using the input Email for an exact match on Contact records.

<input type=”hidden” name=”” value=”Email,true;” />

<input type=”hidden” name=”” value=”Email,true;” />

To use another object, you need to specify one more mapping similarly.

If a matched record is found, Salesforce will open its detail page in a new sub-tab. If more than one record matches, it will display a list of those matched records. If you want to create a new field (in case there is no match found) then you need to use doCreate input.

<input type=”hidden” name=”” value=”FirstName,true;LastName,true;Email,true;Session_Id__c,true” />

The fields specified in the value attribute will be mapped from the pre-chat form to a new Contact record. If you don’t specify doFind, it will always create a new Contact record. So if you want to search, use doFind, and if you want to create a new record, use doCreate. If you want to search and create, use both.

If you want to show a newly created/searched record you can also control that using showOnCreate.

<input type=”hidden” name=”liveagent.prechat.findorcreate.showOnCreate:Contact” value=”true” />

The Live Chat Transcript Object is related to the Contact field via a standard lookup field, so if you want to relate the live chat transcript to the Contact field, you can use saveToTranscript to populate that lookup field on the chat transcript.

<input type=”hidden” name=”liveagent.prechat.findorcreate.saveToTranscript:Contact” value=”Contact” />

Here is a sample of a fully customized pre-chat form:


Previous Article
Two Helpful Tools In Creating New Era Hybrid Mobile Apps
Two Helpful Tools In Creating New Era Hybrid Mobile Apps

By: Kamal Sharma Humanity has evolved to a point where mobile is now the driving force behind day-to-day ac...

Next Article
Tips for an Effective Architecture Review Board
Tips for an Effective Architecture Review Board