Getting Smart with Winter’18 Release
At a time when everyone is eager to onboard the Lightning experience, converting the Visualforce pages to lightning was a huge task. Although there were workarounds, like identifying the UI and rendering the section accordingly, it was not the most optimal solution, as code would have to be repeated. This would then need to be followed up by adding the SLDS class for styling the tags in order to help them match the lightning experience. Quite a task!
To overcome this, Salesforce has given us an early Christmas gift! With the Winter’18 release, Salesforce introduced a new attribute as lightningStylesheets. Using this within the apex:page, the need to identify and re-write the code with all SLDS classes is eliminated altogether. Salesforce internally changes the Visualforce page to a lightning experience. Yes, you read that right! All the tags match the corresponding lightning:input tag and are displayed as per the type.
This new attribute is of Boolean type and if set as true, automatically on switch, changes the UI of page as per the salesforce UI.
Here are a few screenshots that help to get a better idea of how this works.
A] Salesforce Classic
B] Lightning Experience
A known issue with the functioning of this attribute is on the lines of the showHeader attribute. Even though the page has specified showHeader as true, whenever user switches to the lightning experience, the showHeader attribute is overwritten to false.
Limitation apart, this attribute saves a lot of time that was otherwise being spent on manual changes. Couldn’t ask for a better gift from Salesforce now, could I?