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
Laura McCraven at ACNLaura McCraven at ACN 

How do I create a person account with the pre-chat window in live agent?

My code is below, no matter how many variations of this I try, nothing will create my Person Account. If I remove the reference to Record Type Id, it will create without a Record Type and if I change the Record Type Id to a business one, it will create but I can't get it to create the Person Account.  It will also find an existing Person Account correctly.

What am I missing or not mapping correctly? PLEASE HELP! 

        
        First Name: <input type='text' name='liveagent.prechat:AccountFirstName' id='firstName' /><br />
        Last Name: <input type='text' name='liveagent.prechat:AccountLastName' id='lastName' /><br />
        Email: <input type='text' name='liveagent.prechat:AccountEmail' id='email' /><br />
        Phone: <input type='text' name='liveagent.prechat:AccountPhone' id='phone' /><br />
        Issue: <input type='text' name='liveagent.prechat:CaseSubject' id='subject' /><br />
        
        <!-- Hidden fields used to set additional custom details -->
        <input type="hidden" name="liveagent.prechat:CaseOrigin" value="Chat" />
        <input type="hidden" name="liveagent.prechat:CaseStatus" value="New" />
        <input type="hidden" name="liveagent.prechat:CaseRecordType" value="01215000001JRES" />
        <input type="hidden" name="liveagent.prechat:AccountRecordType" value="01215000001JRKk" />
        <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:Account" value="FirstName,AccountFirstName;LastName,AccountLastName;Phone,AccountPhone;PersonEmail,AccountEmail;RecordTypeId,AccountRecordType" />
        
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Subject,CaseSubject;Status,CaseStatus;Origin,CaseOrigin;RecordTypeId,CaseRecordType" />
        
        <!-- doFind, doCreate and isExactMatch example for an Account: 
        Find an Account whose Email exactly matches the value provided by the customer in the form 
        If there's no match, then create an Account 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:Account" value="PersonEmail,true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Account" value="PersonEmail,true" />
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Account" value="FirstName,true;LastName,true;Phone,true;PersonEmail,true;RecordTypeId,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 Account record, found/created above, as the Account on the Case that's created --> 
        <input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Account" value="Case,AccountId" />
        
        <!-- showOnCreate: Open the Account and Case records as sub-tabs to the chat for the agent in the Console -->
        <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Account" 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:Account" value="AccountId" />
        <input type='submit' value='Chat Now' id='prechat_submit' onclick="setName()"/>
Deepali KulshresthaDeepali Kulshrestha
Hi Laura,

If a prechat or deployment page is set up to create a Person Account when chats are submitted, it will fail if the corresponding chat button is Omni-routed.

It is a known issue ,I suggest you visit this link,it will help you:

https://success.salesforce.com/issues_view?id=a1p3A000000f3MlQAI&title=person-accounts-cannot-be-created-via-prechat-or-deployment-api-when-the-chat-button-submitting-the-chat-is-using-omni-routing
 
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Woomastol WoomastolWoomastol Woomastol
The company is infamous for excellent reliability and performance. Preet continues to make a remarkable impact not only in Indian farming community but also in other countries across the world.https://tractorhub.webs.com/