function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How can I set the recordtype on a pre-chat form?

I am trying to set the RecordType value of a new lead when created from a pre-chat form and I can't get it to work.  Here is the relavent code from my VF page.  The lead record is always created with record type id "01200000000019v" despite my efforts to set it to "012000000008QVd" in this code.

            <!--hidden fields written to the new lead-->
            <input type="hidden" name="liveagent.prechat:leadStatus" value="New Lead" />
            <input type="hidden" name="liveagent.prechat:leadSource" value="Web Chat - QDC" />
            <input type="hidden" name="liveagent.prechat:RecordType" value="012000000008QVd" />

            <!-- Map the detail inputs to the Lead fields -->
            <input type="hidden" name="" value="FirstName,leadFirstName;LastName,leadLastName;Company,leadCompany;Email,leadEmail;Phone,leadPhone;Status;leadStatus;LeadSource,leadSource;RecordType,RecordType" />

            <!-- If the Lead is not found, then create one with the following fields set -->
            <input type="hidden" id="optionA" name="" value="FirstName,true;LastName,true;Company,true;Email,true;Phone,true;Status;true;LeadSource,true;RecordType,true" />
I figured out why my code wasn't working.  We have a few validation rules that require data in fields behind the scenes (i.e. not at the field level or page layout level).  I had to adjust those validation rules and now it is working fine.