Using FindOrCreate from Salesforce Chat to link Account to Chat Transcript

Sample Code:
/* Custom detail is to show it to the agent before accepting the Chat and for findOrCreate */
liveagent.addCustomDetail( "Company", "Disney" );
liveagent.addCustomDetail( "First Name", "Mickey" );
liveagent.addCustomDetail( "Last Name", "Mouse" );
liveagent.addCustomDetail( "Email", "[email protected]" );
liveagent.addCustomDetail( "Case Subject", "Test" );
liveagent.addCustomDetail( "Case Status", "New" );

/* FindOrCreate Account and linking to Chat Transcript */
liveagent.findOrCreate( "Account" ).map( "Name", "Company", true, true, true ).saveToTranscript( "AccountId" ).showOnCreate();
    This does a non-exact search on cases by the value of the "Case Subject" custom detail.
    If no results are found, it will create a case and set the case's subject and status
    The case that's found or created will be associated to the chat and the case will open in
    the Console for the agent when the chat is accepted
liveagent.findOrCreate( "Case" ).map( "Subject", "Case Subject", true, false, true ).map( "Status", "Case Status", false, false, true ).saveToTranscript( "CaseId" ).showOnCreate();
    This searches for a contact whose first name, last name ane email exactly match the values in the custom details for First Name, Last Name and Email.
    If no results are found, it will create a new contact and set it's first name, last name, and Email to the values in the custom details
liveagent.findOrCreate( "Contact" ).map( "FirstName", "First Name", true, true, true ).map( "LastName", "Last Name", true, true, true ).map( "Email", "Email", true, true, true );
/* The contact that's found or created will be saved or associated to the chat transcript.
The contact will be opened for the agent in the Console and the case is linked to the contact record */
liveagent.findOrCreate( "Contact" ).saveToTranscript( "ContactId" ).showOnCreate().linkToEntity( "Case", "ContactId" );