I have a prechat form on the live agent chat window. Before initiating the chat we capture certain case related details from the customer. Based on the details provided by the customer, A case is created when the chat session is initiated. Fields we have on the prechat form are all standard fields(FirstName, LastName, Subject, Email, Account Name) except one Custom pick-list field which is Product__C.

Now when a case is created, whatever details are captured from the standard fields are all pre-populated correctly on a case detail page when the chat session is initiated. But the custom Product__c pick-list field is not Pre-populated and is left blank. I looked at my visualforce page but i don't see anything going wrong.

Can anyone help me out with the issue on how to Pre-populate a custom pick-list field on to a case detail page while the chat session is initiated.

Please let me know if there is anything wrong in the below code:

<apex:page showHeader="false" tabstyle="Account" controller="PreChatController">

<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
   <script type='text/javascript'>
      (function() {
        function handlePageLoad() {
          var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
              } if (window.addEventListener) {
                    window.addEventListener('load', handlePageLoad, false);
                 } else { window.attachEvent('onload', handlePageLoad, false);

<h1>Live Agent Pre-Chat Form</h1>

<!-- Form that gathers information from the chat visitor and sets the values to Live Agent Custom Details used later in the example -->
<form method="post" id="prechatForm">
  <apex:outputPanel style="width:50%">
   <apex:pageBlock title="Please fill the following details" id="thePageBlock">
       <apex:pageBlockSection collapsible="false" title="Fields marked with asterisk(*) Symbol are Mandatory." columns="1" id="thePageBlockSection">
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="First Name" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:ContactFirstName" id="firstName"/>
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Last Name" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:ContactLastName" id="lastName"/>
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Email" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:ContactEmail" id="email"/>
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Phone" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:ContactPhone" id="phone" />
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Product" for="account__name" styleclass="reqAst"/>
              <apex:outputPanel >
              <select id="Product__c" required="true" name="liveagent.prechat:Product__c">
                 <apex:repeat value="{!productOptions}" var="prod">
                    <option value="{!prod.value}">{!prod.label}</option>
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Company Name" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:CaseAccount" id="Account" />
          <apex:pageBlockSectionItem >
              <apex:outputLabel value="Inquiry or Concern" for="account__name" styleclass="reqAst"/>
              <input type="text" required="true" name="liveagent.prechat:CaseSubject" id="subject" />

    <!-- Hidden fields used to set additional custom details -->
    <input type="hidden" name="liveagent.prechat:CaseStatus" value="New"/><br />

    <!-- This example assumes that "Chat" was added as picklist value to the Case Origin field -->
    <input type="hidden" name="liveagent.prechat:CaseOrigin" value="Chat"/><br />

    <!-- This example will set the Case Record Type to a specific value for the record type configured on the org. Lookup the case record type's id on your org and set it here -->
    <!--<input type="hidden" name="liveagent.prechat:CaseRecordType" value="012D00123456789" />-->

    <!-- Used to set the visitor's name for the agent in the Console -->
    <input type="hidden" name="liveagent.prechat.name" id="prechat_field_name" />

    <!-- map: Use the data from prechat form to map it to the Salesforce record's fields -->
    <input type="hidden" name="liveagent.prechat.findorcreate.map:Contact" value="FirstName,ContactFirstName;LastName,ContactLastName;Email,ContactEmail;Phone,ContactPhone" />

    <input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Subject,CaseSubject;Status,CaseStatus;Origin,CaseOrigin;RecordTypeId,CaseRecordType;Account,CaseAccount;Product__c,WFM"/>

    <!-- doFind, doCreate and isExactMatch example for a Contact: 
        Find a contact whose Email exactly matches the value provided by the customer in the form 
        If there's no match, then create a Contact record and set it's First Name, Last Name, Email, and Phone to the values provided by the customer -->
    <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact" value="Email,true" />
    <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact" value="Email,true" />
    <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Contact" value="FirstName,true;LastName,true;Email,true;Phone,true" />

    <!-- doCreate example for a Case: create a case to attach to the chat, set the Case Subject to the value provided by the customer and set the case's Status and Origin fields -->
    <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Subject,true;Status,true;Origin,true;RecordTypeId,true" />

    <!-- linkToEntity: Set the record Contact record, found/created above, as the Contact on the Case that's created --> 
    <input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />

    <!-- showOnCreate: Open the Contact and Case records as sub-tabs to the chat for the agent in the Console -->
    <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />
    <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />

    <!-- saveToTranscript: Associates the records found / created, i.e. Contact and Case, to the Live Chat Transcript record. --> 
    <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="ContactId" />
    <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="CaseId" />

    <!-- displayToAgent: Hides the case record type from the agent -->
    <input type="hidden" name="liveagent.prechat.findorcreate.displayToAgent:CaseRecordType" value="false" />

    <!-- searchKnowledge: Searches knowledge article based on the text, this assumes that Knowledge is setup -->
    <input type="hidden" name="liveagent.prechat.knowledgeSearch:CaseSubject" value="true" />

    <input type='submit' value="Start Chat Session" id="prechat_submit" onclick="setName()"/>

    <!-- Set the visitor's name for the agent in the Console to first and last name provided by the customer -->
    <script type="text/javascript">
      function setName() {
        document.getElementById("prechat_field_name").value =  
          document.getElementById("firstName").value + " " + document.getElementById("lastName").value;

    <style type="text/css">
        p {font-weight: bolder }

         content: "*";
         position: absolute;
         margin-left: 3px;
         color: #a94442;



You must log in to answer this question.

Browse other questions tagged .