• Daniela Covi
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hello Community!

I'm seeking for your help as I'm not really practical with VF codes - mainly when it comes down to Classic VS LEX.

The code below allows users to hit 'New Case' button and create a new case in a separate tab. The form will be already populate with account details and transction number. This only happens in Classic. 
In LEX, although users are able to create a New Case - account and transction information are not automatically filled in.

Any idea?

<apex:page controller="ExternalObjectTransactionCtrl" sidebar="false" showHeader="true" action="{!initiateAPIAccessRequest}" tabStyle="Case"> <!--<apex:includeScript value="/support/console/33.0/integration.js"/>--> <apex:includeScript value="/support/console/44.0/integration.js"/> <script type="text/javascript"> window.onload = function setCustomConsoleStyle(){ rerenderTopPanel(); } // Global variables var primaryTabId; var primaryObjectId; var transExternalId; // Get Primary Tab ID and Primary Object ID function openNewSubTabForNewCase(pTransExternalId) { transExternalId = pTransExternalId; // get Primary Tab ID sforce.console.getFocusedPrimaryTabId(showPrimaryTabId); } // get Primary Tab ID var showPrimaryTabId = function showPrimaryTabId(result) { primaryTabId = result.id; // get the Primary Tab Object ID sforce.console.getFocusedPrimaryTabObjectId(showPrimaryObjectId); }; // get the Primary Tab Object ID var showPrimaryObjectId = function showPrimaryObjectId(result) { primaryObjectId = result.id; // Open a standard page for "New Case" as a Sub Tab openSubTabForNewCase(); }; // Open a standard page for "New Case" as a Sub Tab function openSubTabForNewCase(){ sforce.console.openSubtab(primaryTabId, '/setup/ui/recordtypeselect.jsp?ent=Case&ekp=500&save_new_url=/500/e?def_account_id='+ primaryObjectId +'&ekp=500&ent=Case&'+'{!$Label.TransactionNumber_DOM_ID}'+'='+transExternalId, true, '{!$Label.NewCase}', null); } // FOR REFRESH CURRENT TAB function refreshCurrentTab(){ //window.top.location = '/console'; window.top.location = '/lightning/console'; } </script> <style> .LoadingMessage{ left: 50%; top: 50%; margin-left: 20px; margin-top: 15px; position: fixed; z-index: 999; } </style> <apex:form > <apex:sectionHeader title="Transactions" subtitle="{!$CurrentPage.parameters.transExternalId}"/> <apex:pageMessage rendered="{!IF(errorMessage <> null, true, false)}" summary="{!errorMessage}" severity="FATAL" strength="2"/> <apex:outputPanel id="listCasesPanel" rendered="{!IF(errorMessage == null, true, false)}"> <!-- Show message : Please wait assigning selected Transaction. status="status"--> <center><b><apex:actionStatus id="status" startText="{!$Label.IframeCase_AssignMassTransactionMessage}" startStyle="color:{!$Label.WorldRemit_Green_Colour}"/></b></center> <apex:pageBlock title="Cases" mode="edit" id="listCasesPageBlock"> <apex:pageBlockButtons location="top"> <apex:commandButton value="{!$Label.AssignSelectedTransactionButton}" action="{!massAssignTransactionToCases}" status="status" oncomplete="refreshCurrentTab();" disabled="{!IF(lstCaseWrapper.size == 0, True, False)}"/> <apex:commandButton value="{!$Label.NewCaseButton}" onclick="openNewSubTabForNewCase('{!$CurrentPage.parameters.transExternalId}');"/> <!-- <apex:commandButton value="{!$Label.NewCaseButton}" onclick="openNewSubTabForNewCase('{!$CurrentPage.parameters.transExternalId}', '{!availableAndDefaultRecordTypeId}');" oncomplete="window.location.reload();"/> <a HREF="#" onClick="openNewSubTabForNewCase('{!$CurrentPage.parameters.transExternalId}', '{!availableAndDefaultRecordTypeId}');">{!$Label.NewCaseButton}</a> <button onclick="openNewSubTabForNewCase('{!$CurrentPage.parameters.transExternalId}', '{!availableAndDefaultRecordTypeId}');">{!$Label.NewCaseButton}</button> --> </apex:pageBlockButtons> <!-- This Div is helpful for Horizontal and Vertical Scroll bars reRender="theForm, transactionDetailPanel" --> <div style="height: {!$Label.IframeCase_PaginationHeight}px; overflow-x:scroll; overflow-y:scroll;"> <!-- Show Transaction(s) which meets the defined the crtieria --> <apex:pageBlockTable value="{!Cases}" var="caseWrapper" rendered="{!IF(lstCaseWrapper != null && lstCaseWrapper.size>0, True, False)}"> <apex:column headerValue="{!$Label.TransactionCaseList_SelectionColumnName}"> <apex:inputCheckbox value="{!caseWrapper.isSelected}" disabled="{!IF(caseWrapper.caseRecord.Transaction_Number__c <> null, True, False)}"/> </apex:column> <!-- Show Transactions using a Field Set "TransactionSearch_FieldSet" --> <apex:repeat value="{!$ObjectType.Case.FieldSets.CaseSearch_FieldSet}" var="fieldAPIName"> <apex:column headerValue="{!fieldAPIName.Label}" rendered="{!IF(fieldAPIName.Label == 'Case Number', True, False)}"> <apex:outputLink value="/{!caseWrapper.caseRecord.Id}" id="theLink">{!caseWrapper.caseRecord[fieldAPIName]}</apex:outputLink> </apex:column> <apex:column headerValue="{!fieldAPIName.Label}" rendered="{!IF(fieldAPIName.Label <> 'Case Number', True, False)}"> <apex:outputField value="{!caseWrapper.caseRecord[fieldAPIName]}"/> </apex:column> </apex:repeat> </apex:pageBlockTable> </div> <!-- Show Buttons for Pagination --> <center> <apex:outputPanel id="paginationButtonsPanel"> <apex:panelGrid columns="5" bgcolor="{!$Label.WorldRemit_Green_Colour}" rendered="{!IF(lstCaseWrapper != null && lstCaseWrapper.size>0, True, False)}"> <apex:commandButton action="{!first}" value="{!$Label.Iframe_FirstButton}" disabled="{!IF(pageNumber = 1, True, False)}"/> <apex:commandButton action="{!previous}" value="{!$Label.Iframe_PreviousButton}" disabled="{!NOT(hasPrevious)}"/> <apex:outputText value="page {!pageNumber} of {!TotalPages}" rendered="{!TotalPages > 0}"></apex:outputText> <apex:commandButton action="{!next}" value="{!$Label.Iframe_NextButton}" disabled="{!NOT(hasNext)}"/> <apex:commandButton action="{!last}" value="{!$Label.Iframe_LastButton}" disabled="{!IF(pageNumber = TotalPages, True, False)}"/> </apex:panelGrid> </apex:outputPanel> </center> </apex:pageBlock> </apex:outputPanel> <apex:actionFunction name="rerenderTopPanel" rerender="transactionDetailPanel" status="iframeActionStatus"/> <apex:outputPanel id="transactionDetailPanel"> <apex:actionStatus id="iframeActionStatus" stopText="" startText="Start"> <apex:facet name="start"> <div class="LoadingMessage"> <table border="0" width="100%" height="100%"> <tr> <td align="center"><b>{!$Label.Iframe_LoadingProcessBarMessage}</b></td> </tr> <tr> <td align="center"><img src="{!$Resource.ProcessBar}"/></td> </tr> </table> </div> </apex:facet> <apex:facet name="stop"> <apex:iframe title="{!$Label.Iframe_TransactionDetail}" src="{!endPointURL}" frameborder="true" scrolling="true" rendered="{!IF(errorMessage == null, true, false)}" height="1000px" width="100%"/> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:form> </apex:page>

Really appreaciate your assistance on this!

 

I am implementing Live Agent in an environment using PersonAccounts. I am deploying it via snap-ins in Lightning. I use the snap-in prechat page with the Service Scenario - Associate chats with contacts and cases.

When using this, it works, but it shows Contact records instead of Account records (when using Person Accounts these are technically identical, but Contact page layout doesn't display the information I need and this information is on the Person Account page layout) and it also creates new contacts if the chat visitor is unkown - creating a new contact/account is not desired.

To display a PersonAccount record and not to create a new record if the visitor is unkown I use the following custom extraPrechatInfo and extraPrechatFormDetails:
 
embedded_svc.settings.extraPrechatInfo = [{"entityFieldMaps":[{"doCreate":false,"doFind":false,"fieldName":"LastName","isExactMatch":false,"label":"Last Name"},{"doCreate":false,"doFind":false,"fieldName":"FirstName","isExactMatch":false,"label":"First Name"}, {"doCreate":false,"doFind":false,"fieldName":"Email","isExactMatch":false,"label":"Email"}],"entityName":"Contact","saveToTranscript":"","showOnCreate":false},{"entityName":"Account","showOnCreate":false,"entityFieldMaps":[{"isExactMatch":true,"fieldName":"PersonEmail","doCreate":false,"doFind":true,"label":"Email"},{"isExactMatch":true,"fieldName":"Brand__c","doCreate":false,"doFind":true,"label":"VisitorBrand"}]},{"entityFieldMaps":[{"doCreate":true,"doFind":false,"fieldName":"Subject","isExactMatch":false,"label":"Subject"},{"doCreate":true,"doFind":false,"fieldName":"SuppliedEmail","isExactMatch":false,"label":"Email"}, {"doCreate":true,"doFind":false,"fieldName":"SuppliedName","isExactMatch":false,"label":"Last Name"},{"doCreate":true,"doFind":false,"fieldName":"Origin","isExactMatch":false,"label":"CaseOrigin"}],"entityName":"Case","saveToTranscript":"Case","showOnCreate":true}];
embedded_svc.settings.extraPrechatFormDetails = [{"label":"Last Name", "transcriptFields": ["Last_Name__c"]},{"label":"First Name", "transcriptFields": ["First_Name__c"]},{"label":"Subject", "transcriptFields": ["Subject__c"]},{"label":"Email", "transcriptFields": ["Email__c"]},{"label":"VisitorBrand","value":"2","transcriptFields":[],"displayToAgent":true},{"label":"CaseOrigin","value":"Chat","transcriptFields":[],"displayToAgent":true}];
It works fine in the DEV sandbox but in the TEST sandbox it doesn't search for the account if the chat is coming from a known visitr = existing account. No errors are visible in the debug logs.

Do you have an idea what might be causing this?