Thursday, September 28, 2017

What makes Visualforce In Salesforce Classic & Lightning Experience different?


1) Development Mode for Visualforce is only available in Salesforce Classic and not in Lightning.

2) Pages you view using direct URL access always display in Salesforce Classic and not in Lightning. The reason is in order to view your page in Lightning Experience, you need to access the Lightning Experience container app. This means accessing /one/one.app. If you’re accessing that, you can’t access /apex/PageName. They’re just two different URLs that don’t overlap.

To test your page in Lightning Experience, add the following bookmarklet to your browser’s menu or toolbar -

javascript:(function(){ 

    var pageName = prompt('Visualforce page name:'); 
    $A.get("e.force:navigateToURL").setParams(
        {"url": "/apex/" + pageName}).fire();})();

3) Use the $User.UITheme and $User.UIThemeDisplayed global variables to determine the current user experience context in Visualforce context. These global variables return a string that uniquely identifies the current user interface context. The difference between the two variables is that $User.UITheme returns the look and feel the user is supposed to see, while $User.UIThemeDisplayed returns the look and feel the user actually sees. 

The possible values for $User.UITheme and $User.UIThemeDisplayed are the same:

  • Theme1—Obsolete Salesforce theme
  • Theme2—Salesforce Classic 2005 user interface theme
  • Theme3—Salesforce Classic 2010 user interface theme
  • Theme4d—Modern “Lightning Experience” Salesforce theme
  • Theme4t—Salesforce1 mobile Salesforce theme
  • PortalDefault—Salesforce Customer Portal theme
  • Webstore—Salesforce AppExchange theme

4) Use the UserInfo.getUiTheme() and UserInfo.getUiThemeDisplayed() system methods to determine the current user experience context in Apex code. The possible values returned by these methods are the same as those returned by the $User.UITheme and $User.UIThemeDisplayed global variables.

5) Lightning Experience manages navigation using "Events" (use 'sforce.one' object) while in Salesforce Classic we have "PageReference" for performing navigation actions.

6) Use <apex:slds> component to reference Lightning Design System stylesheets without uploading them as a static resource, simplifying the syntax of your page and preventing you from hitting the 250-mb static resource limit.

7) Some more differences that we can make in between Visualforce page running in Salesforce Classic compared to Lightning Experience are -

a) In Salesforce Classic, Visualforce “owns” the page. But in Lightning Experience, Visualforce runs inside an iframe that’s wrapped inside the larger Lightning Experience container.
b) Lightning Experience and Visualforce pages are not only held in different browser contexts, they’re also served from different domains. So, even though it’s all showing in one browser window, the session ID inside the Visualforce iframe will be different than the session ID outside the iframe, in another part of Lightning Experience.
c) <apex:page> showHeader and sidebar attributes are always false.




Happy Weekend Friends!!!! 😊

5 comments:

  1. Cloud-based CRM helps in different roles of storing and retrieving data. In Cloud Computing, Salesforce is one of the major things to be noted provides applications includes ERP, CRM etc., Thanks for your clear explanation of the relationship between Cloud and Salesforce.
    Regards:
    Salesforce Training in Chennai | Salesforce Training

    ReplyDelete
  2. Excellent knowledge was shared, it helps me to explore more things.

    Salesforce Course

    Salesforce Developer Training

    ReplyDelete
  3. Latest Certification Dumps of Salesforce , Amazon , IBM , Microsoft, SAP, Oracle , VMware available at https://www.ebsose.com or mail us at ebsosedotcom@gmail.com or certificationdirectdumps@gmail.com for any dumps / Superbadge /Development project queries . Get Fast replies and our team is available 24/7 . Success rate is 99.99% , so hurry and ping us .
    Reach out at ebsosedotcom@gmail.com for any development project or superbadge help required in salesforce or any other technology .

    ReplyDelete