1

Background: We are wanting to use Live Agent for customers only on our Community Site(behind login). I am trying to limit visibility to certain clients based on the Community User record. I am trying to reference a new field that I created (LiveAgentUser__c), but it just isn't referencing. I changed my rendered field to one that was rendered previously and it worked without issue, but when I reference LiveAgentUser__c it doesn't render the Live Chat Button. I'm not very strong with the development side of things and have been brainstorming/googling for the past week trying to get this working. Any help would be amazing!

Button and Deployment code that I have copied/built:

<apex:outputPanel rendered="{! ISPICKVAL($User.LiveAgentUser__c,'Therapy') }">
<img id="liveagent_button_online_573230000008OOD" style="display: none; border: 0px none; cursor: pointer" onclick="liveagent.startChat('573230000008OOD')" src="https://danieldev-sourcemed.cs28.force.com/clientservices/resource/1459522540000/ChatwithSupport" /><div id="liveagent_button_offline_573230000008OOD" style="display: none;"><!-- Offline Chat Content --></div><script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('573230000008OOD', document.getElementById('liveagent_button_online_573230000008OOD'));
liveagent.showWhenOffline('573230000008OOD', document.getElementById('liveagent_button_offline_573230000008OOD'));
});</script>
</apex:outputPanel>

<script type='text/javascript' src='https://c.la3-c2cs-chi.salesforceliveagent.com/content/g/js/36.0/deployment.js'></script>
<script type='text/javascript'>
liveagent.init('https://d.la3-c2cs-chi.salesforceliveagent.com/chat', '572230000008OL4', '00D230000008jvr');

liveagent.addCustomDetail('CaseOrigin', 'Therapy Chat');
liveagent.addCustomDetail('CaseSubject', 'Therapy Live Chat Case');
liveagent.addCustomDetail('CaseContact', '{!$User.ContactId}');
liveagent.findOrCreate("Case").map("ContactId", "CaseContact", false, false,true);
liveagent.findOrCreate("Case").map("Origin", "CaseOrigin", false, false,true);
liveagent.findOrCreate("Case").map("Subject", "CaseSubject", false, false,true);

liveagent.findOrCreate("Case").showOnCreate();
liveagent.findOrCreate("Case").saveToTranscript("CaseId");
</script>

Apex Class that is referenced:

public with sharing class CommunityHelper {
  public static User currentUser {
    get {
      return [SELECT Id, LiveAgentUser__c, AccountId, Account.Name, Account.TotalPointsTT__c, Account.TotalHoursTT__c, Account.SourceAdvantageLevel__c, Division__c, Account.ProductLine__c, Contact.Account.Owner.Email, Contact.Account.Owner.Name, Contact.Account.AccountOwnersEmail__c FROM User WHERE Id = :UserInfo.getUserId()];
    }
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.