Friday, February 18, 2022

Improve performance and speed in Lightning Experience

 

Improve performance and speed in Lightning Experience:

 

Salesforce Performance Test:

1.   To access this tool, log-on to Salesforce org and remove everything after “[your domain name].lightning.force.com/” in the browser URL. Keep the forward slash after “force.com”



2.       Replace it with “speedtest.jsp”. So your new URL would look something like this “https://[your domain name].lightning.force.com/speedtest.jsp”. Click “Enter”.



3.       click “Test” Speed”



4.       Once Test is finished, results will be displayed.



5.       Requirements for the best Lightning performance

a.       For the fastest and most stable experience, Salesforce recommends:

                                                               i.      An Octane score of 30,000 or higher

                                                             ii.      Network latency of 150 ms or lower

                                                           iii.      A download speed of 13 Mbps or higher

                                                           iv.      At least 8 GB of RAM, with 3 GB available for Salesforce browser tabs

b.       Minimum requirements are:

                                                               i.      An Octane score of 20,000 or higher

                                                             ii.      Network latency of 200 ms or lower

                                                           iii.      A download speed of 1 Mbps or higher

                                                           iv.      At least 5 GB of RAM, with 2 GB available for Salesforce browser tabs

6.       Lightning page load times:

a.       There are two ways you can add a load time counter directly in the Lightning UI:.

                                                               i.      Lightning Component Debug Mode – This setting adds a counter in the top right corner of the Lightning UI that shows page load time and bandwidth. It’s important to note that with this setting enabled, component code is not minified, so overall performance may be impacted.

                                                             ii.      Adding ?eptVisible=1 to the Lightning URL – For example, https://<example>.lightning.force.com/one/one.app?eptVisible=1. Adding this string to your URL in the address bar adds a counter similar to the Lightning Component Debug Mode for showing the page load time, but it does not obfuscate component code, and so there is less of an impact on performance load time.

 

For more information:

Improve performance and speed in Lightning Experience (salesforce.com)

Lightning Components Performance Best Practices | Salesforce Developers Blog

 

 

Saturday, May 2, 2020

How to pass language to Custom Chat Page in SFDC Chat

How to pass language to Custom Chat Page


Problem Statement:
When we have started implementing SFDC chat functionality, there was a requirement to create multiple Chat Buttons based on Country and Language. So we decided to create a Pre-Chat Form page and multiple Custom Chat Page based on number of countries and Language since there is no options to pass Language to Custom Chat Page(standard browser behavior which ignores whatever comes after #). But we did not get approval to create that many number of VF pages from Architect team so decided to implement without creating multiple VF pages. We have searched many links, we did not get any information. Later we found a crazy idea to pass Language to Custom Chat Page and below is the idea.

Solution:
Idea is simple, in pre chat form page, we have to populate a hidden field from custom setting/ metadata based on button code. When we click on Chat now, SFDC internally, form an URL with all the inputs which we have entered in the pre-chat form page. Custom Chat page controller capture the URL which has all pre chat page inputs and assigns language. Code snippet below

Create Pre-Chat Form Page:

Pre chat Controller:

public class getLanguage{
    public String languageCode;
    public String getLangCode(){
String fullURL=ApexPages.currentPage().getUrl();
String[] subURLStrings=fullURL.split('%26');
for(string str:subURLStrings){
  if('button_id'.equalsIgnorecase(str.SubStringBefore('%3D'))){
   buttonId=str.SubStringAfter('%3D');
  }
}
if(buttonId != null){
Button_Language__c buttonLang = Button_Language__C.getInstance('buttonId');
languageCode = buttonLang.LangCode__c;
}
return languageCode;
    }
}


Pre-Chat Page:

along with other fields add below hidden field.
<apex:page id="pg" showHeader="false" controller="getLanguage" language="{!languageCode}"> 
.
.
.

<input type="hidden" name="liveagent.prechat:LanguageCode" value="{!languageCode}" />

<input type="hidden" name="liveagent.prechat.save:LanguageCode" value="Language__c" />
.
.
.
</apex:page>


Custom Chat Page:

Custom Chat page Controller:

public class getCustChatLanguage{
    public String langCode { get; set; }
    public String lang;
     
    //Method to get the language in chat page
    public getCustChatLanguage (){
    
        lang = JSON.serialize(ApexPages.currentPage().geturl());
        if(String.IsNotBlank(lang)){ 
        try{
            lang = lang.substringAfter('liveagent.prechat%3ALanguageCode='); 
            lang = lang.substring(0,5);
            langCode = lang;
            }catch(Exception e){
                System.debug(e.getmessage());
            }
        }
    }

}

Custom Chat Page:

<apex:page showHeader="false" controller="getCustChatLanguage" language="{!langCode}"> 

.
.
.
.
.
</apex:page>






Improve performance and speed in Lightning Experience

  Improve performance and speed in Lightning Experience:   Salesforce Performance Test: 1.     To access this tool, log-on to Salesfo...