• Sonal Dixit 8
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I am working on a PreChat VisualForce page. On that page, the customer enters the following info into the perchat form:
First Name (FirstNameDetail), Last Name(LastNameDetail), Email(EmailDetail), and Customer Number (CustomerNumber).

I am trying to do 2 separate isExactMatch hidden fields:
  1. Open the Account if CustomerNumber in the form is an exact match to Customer_Number__c custom field on Account
  2. Open the Contact if EmailDetail in the form is an exact match to Email on Contact AND the CustomerNumber field in the form is an exact match to the Customer_Number__c field on the Contact.
Note: The Customer_Number__c field on the Contact is a text based Formula field that just displays 'Account.Customer_Number__c' on each Contact Record.

I know that INDIVIDUALLY, each of my ExactMatches work. I know this because I tested the Account ExactMatch by itself by removing the Contact ExactMatch from the page, and I also did the reverse and tested the Contact ExactMatch by removing the Account ExactMatch. In each scenario, the Account or Contact record was successfully opened as an Exact Match in a subtab in the console. However, when adding both together to the page, it doesn't open 2 sub-tabs as I'm hoping it would.

Desired Result:
  1. If Customer Number matches on the Account but Email/Customer Number doesn't match on the contact - I want to load the Account Page only.
  2. If Customer Number matches on Account AND Email/Customer Number on Contact matches, I want to have the Account Page AND the Contact Page loaded as 2 separate sub-tabs within the Service Console window for the live agent session.

Current Result:
Right now with my current implementation, desired result #1 works as expected. I enter a customer number and an incorrect email, and it loads up the correct account and no contact record.
However, desired result #2 is not working as expected. If I enter a customer number and a CORRECT email of a contact linked to that account, it loads up a Search Results page that displays the Account and the Contact, rather than loading the account and contact into their own subtabs, as seen in the screenshot below:
User-added image
My desired result is that when it exact matches all criteria, it opens up the Account in a Subtab, and the Contact in another subtab, instead of just giving me a search results page like I'm getting now.

Reason:
The reason I am doing this is because in our specific Salesforce Instance, it is possible for a contact to exist more than once with the same email address, but under different accounts, because one contact may own or operate multiple accounts. Each of our accounts is identified by a unique number called Customer Number, and so I need to match for contacts of THAT specific account, rather than just contacts as a whole. If I limit myself to searching only Email, I could end up with 20+ different contact results of the same person on 20+ different accounts.

Code:
<apex:page showHeader="false"> 
<!-- CSS and SCRIPTS removed to save space on Dev Forum Post-->
<div>
    <form method='post' id='prechatForm'> 
        <table class="formTable">
            <tr>
                <td><b>First Name:</b></td>
                <td><input type='text' name='liveagent.prechat:FirstNameDetail' /> </td>
            </tr>
            <tr>
                <td><b>Last Name:</b></td>
                <td><input type='text' name='liveagent.prechat:LastNameDetail' /></td>
            </tr>
            <tr>
                <td><b>Email Address:</b></td>
                <td><input type='text' name='liveagent.prechat:EmailDetail' /></td>
            </tr>
            <tr>
                <td><b>Customer Number:</b></td>
                <td><input type='text' name='liveagent.prechat:CustomerNumber' /></td>
            </tr>
            <tr><td>&nbsp;</td></tr>
            <tr>
                <td><b>Department:</b></td>
                <td>
                        <select name="liveagent.prechat.buttons">
                        <!-- Values are LiveChatButton IDs. -->
                        <option value="573U0000000TTKV">ABC Support</option>
                        <option value="573U0000000TTzY">XYZ Support</option>
                        <!--<option value="573U0000000TTzY,573U0000000TTKV">XYZ Support If Available,
                        otherwise ABC Support</option>-->
                        </select>
                </td>
            </tr>
            <tr><td>&nbsp;</td></tr>
            <tr>
                <td><input type='submit' value='Start Chat' id='prechat_submit'/></td>
            </tr>
        </table>

<!--Save Email Address to Chat Transcript-->
<input type="hidden" name="liveagent.prechat.save:EmailDetail" value="Email__c" />
<!--Save Customer Number to Chat Transcript-->
<input type="hidden" name="liveagent.prechat.save:CustomerNumber" value="Customer_Number__c" />

<!--POP OUTS-->

    <!-- ACCOUNT -->
        <!--Map To an Account if CustomerNumber variable in form equals Customer_Number__c custom field on account -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Account"
        value="Customer_Number__c,CustomerNumber" />
        
        <!--doFind where Customer_Number__c match = true -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Account"
        value="Customer_Number__c,true" />
        
        <!--Open the Account when we find an Exact Match -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Account"
        value="Customer_Number__c,true" />

    <!-- CONTACT -->
        <!--Map to a Contact if CustomerNumber variable and EmailDetail variable in form match to Customer_Number__c and Email field on contact-->
        <input type="hidden" name="liveagent.prechat.findorcreate.map:Contact"
        value="Customer_Number__c,CustomerNumber;Email,EmailDetail" />
        
        <!--doFind where Customer_Number__c match = true and Email match = true -->
        <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Contact"
        value="Customer_Number__c,true;Email,true" />
        
        <!--Open the Contact whne we find an Exact Match-->
        <input type="hidden" name="liveagent.prechat.findorcreate.map.isExactMatch:Contact"
        value="Customer_Number__c,true;Email,true" />

</form> 
</div>
</apex:page>


I've been racking my brain on this all morning and not getting any farther - could use some extra brain power from the community. All thoughts and input appreciated. Thanks!