Top 5 Scripts you need to Know before Dealing with Visualforce Pages.

1.)  Is it Lightning experience OR classic view ?

Have you ever faced a problem of identifying in which experience user is opening your page (VFP)? Is it lightning or classic.

LEXHome

Well, here is the solution to it. There are two ways :

# Using Apex:

j

# Using JS on Visualforce Page:

k

You can use two parameters to check this 'sfdcIFrameOrigin' and 'istdp'. Now you can easily identify in which experience the user is via your code.

_________________________________________________________________________________

2.)  OutputPanel  Refresh  using  jquery 

dom-and-jquery-hires

You can try to use a dummy apex:actionFunction to reRender any component on the page.

DF

_________________________________________________________________________________

 

3.) Reload Page after an action using using Javascript.

e

fx

_________________________________________________________________________________

 

4.) Remove Enter Functionality from InputFields in a Visualforce Page.

 

m

_________________________________________________________________________________

 

5.) URL Navigation in Salesforce Classic vs Lightning from single Button.

Suppose you have a Home Button which redirects you to the HomePage of your Salesforce Org.Now the URL which you will specify will be different for Classic & for Lightning.You need to write something like this :

Open Link in Lightning vs Classic

_________________________________________________________________________________

 

“The city is flying, we're fighting an army of robots, and I've got a bow. Nothing is making sense! Except a Good Script".

emoji1

Popular Salesforce Blogs