• Quentin Cotillard
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
I am trying to create a new lead record when a new chat is initiated after filling in a pre-chat form.
My probleme is that instead of opening a new lead tab with the information filled in by the user, I get a "Select Lead Record Type" tab where the agent has to select the record type for the lead. Once they select the recordtype the lead has none of the information provided.
I can't have a default recordType set since the recordType is going to be definied by user input.
I have seen many questions regarding this issue but none have a working solution.

Here is the visualforce pre-chat form I have:

<form method='post' id='prechatForm'> 
      <label for="liveagent.prechat:FirstNameDetail">First Name:</label>
          <input type='text' name='liveagent.prechat:FirstNameDetail' required='true' /><br />
      <label for="liveagent.prechat:LastNameDetail">Last Name:</label>
          <input type='text' name='liveagent.prechat:LastNameDetail' required='true' /><br />
      <label for="liveagent.prechat:EmailDetail">Email Address:</label>
          <input type='email' name='liveagent.prechat:EmailDetail' required='true' /><br />
      <label for="liveagent.prechat:provider">Are you a provider?:</label>
          <input type="radio" name="liveagent.prechat:provider" value="yes" required='true'/> Yes
          <input type="radio" name="liveagent.prechat:provider" value="no" required='true'/> No
      <div id="zipfield" style="display: none;">
          <label for="liveagent.prechat:ZipDetail">Zip code:</label> <input type='text' name='liveagent.prechat:ZipDetail'/>
      <input type="hidden" name="liveagent.prechat:leadStatus" value="Open" />
      <input type="hidden" name="liveagent.prechat:Company" value="none" />
      <input type="hidden" name="liveagent.prechat:RecordType" value="01260000000YLBs" />

      <!-- Map input to lead fields -->
      <input type="hidden" name="liveagent.prechat.findorcreate.map:lead"
        value="FirstName,FirstNameDetail;LastName,LastNameDetail;Company,Company;Email,EmailDetail;Status,leadStatus;RecordType,RecordType" />

      <!-- Try to find the Lead by email (exact match) -->
      <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Lead"
        value="Email,true" />
      <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Lead"
        value="Email,true;" />

      <!-- If the Lead is not found, then create one with the following fields set -->
      <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Lead"
        value="FirstName,true;LastName,true;Email,true;Company,true;Status,true;RecordType,true" />

      <!-- If a new Lead record has been created, open it as a subtab -->
      <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Lead"
        value="true" />
      <!-- displayToAgent: Hides the lead record type from the agent -->
      <input type="hidden" name="liveagent.prechat.findorcreate.displayToAgent:RecordType" value="false" />

      <!-- Save the Lead id to transcript's field ContactId -->
      <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Lead"
        value="LeadId" />

     <input type= "hidden" name= "liveagent.prechat.findorcreate.displayToAgent: String detailName" value= "Boolean display" />
      <div id="submit">  
          <input type='submit' value='Request Chat' id='prechat_submit'/>