Category: Lightning

Convert VisualForce page into Lightning with no efforts

Convert VisualForce page into Lightning with no efforts

For the Lightning transition, we don’t need to convert all our visualforce pages to lightning component because visualforce pages works in lightning experience.
we prefer to convert only those pages in which we need the speed of lightning so that the productivity of the user could be increased.

Pages which are not very complex in structure and delivers basic functionality, we don’t want to put so many efforts on them
And Lightning transition is a very big activity so It’s a good idea that we don’t spend too much time on simple pages and just use them as it is.
But if we are in lightning and everything looks beautiful and these small pages could make our beautiful transition ugly.

So the scenario is –

  • we need to migrate to Lightning but we have less time.
  • Need common look and feel for all pages and components.
  • Don’ want to make efforts to rebuild these pages.

If you can relate to these above points then you are at the right place ;p

This trick can help to save your time, money and efforts

This piece of code determines weather user is in classic or Lightning.

public boolean getIsClassic()
return (userInfo.getUiThemeDisplayed() == ‘Theme3’);

In Vf page we use SLDS style only when user is in Lightning experience.

<apex:page standardController=”Case” extensions=”CaseController” standardStylesheets=”{!IsClassic}” LightningStylesheets=”{! !IsClassic}”><apex:outputPanel rendered=”{! !IsClassic}”>
<apex:slds />

If some of the components like the pageblock table is not rendering smoothly then you can use some custom styling and place it inside the same output panel.

<apex:page standardController="Case" extensions="CaseController" standardStylesheets="{!IsClassic}" LightningStylesheets="{! !IsClassic}">

<apex:outputPanel rendered="{! !IsClassic}">
	<apex:slds />
	body .bPageBlock .detailList .dataCol {
		margin-bottom: 0rem !important;
		margin-top: 0rem !important;
		padding-top: 0rem !important;
		padding-bottom: 0rem !important;
		display: table-cell !important;
	body .detailList .dataCol select{
		min-width: 15rem !important;
		width: 15rem !important ;
	body .dataCol textarea {
		min-width: 15rem !important;
		width: 15rem !important ;
		height: 45px;
	body .pbSubsection{
		padding-top: 0rem !important;
		padding-bottom: 0rem !important;
	body .detailList tbody tr{
	width: 250px;
	body .bPageBlock .pbSubheader{
		margin-bottom: 8px !important;
		line-height: normal !important;
	body .pbHeader .pbButton{
		text-align: center;
	body .pbButton .btn, body .pbButtonb .btn {
		background-color: #9e801a;
		color: white;
Know your Einstein Bot

Know your Einstein Bot

Salesforce provides Einstein Bots to build smart assistance for your customers through chat, messaging or voice. Bots answer customer questions with the right information and very efficiently.
Bot saves a lot of human effort and narrows down customers for Agents, they answer simple queries of customers like updating passwords or getting information related to customer and may be difficult tasks if we configure advance level bot.

When you’re ready to set up Einstein Bots for your production org, you need:

  • A Service Cloud license
  • A Live Agent license
  • Lightning Experience

Then you need to set up these things-

  • Publish a Salesforce Community
  • Live Agent setup
  • Add Snap-Ins Chat to Your Community

I am skipping these things because you can learn to set up these things from Trailhead in a better and detailed way. There is a Project named “Build an Einstein Bot” and it has all the info you need to set up bot Prerequisite.
Once you will setup above mentioned things then you can create an Einstein Bot.

So we can move forward to complex things and get to know everything about the bot. An Einstein bot has four options-

  1. Dialogs – we can add certain steps or series of steps in dialogs which includes Messages, Question, Action, Rules.
  2. Entities – If we need input from a customer in a certain format then we use Entities.
  3. Variables – These variables hold values which we get from a customer, Invocable Apex or Flows.
  4. Performance – In this section, we can check performance and error when bot fails.


It has four option and we can any of them in a sequence and bot execute them one by one.


If we want that Bot needs to say something to a customer then we use messages. It can be dynamic by using variables.
Ex – Hi {!VariableName}!


We can ask some questions to a customer and store the answer into some variable and use elsewhere. This also provides showing options to the customer, both static and dynamic. Also, display them as a Menu or Buttons.
Static – Add choices as text when configuring a question.
Dynamic – Pull choices from the Invocable apex or Flow dynamically.


An action will be performed when it bot reaches to this type of step which includes Apex, Flow, Send email.
Apex- An Invocable class method can be called from this action and output of the method will be assigned to any variable.


We can pass some inputs to the flow and flow will return Output(Only flow output variables will show on Bot UI for assigning them to bot variables)

Send Email

An Email will be sent according to the values passed in this step.


We can set some rules like on these conditions perform these actions(conditions and actions can’t be more than 5)

  • Condition – Set conditions on variables like it is set or not or equals to some value.
    • possible values –  Equals, Does Not Equal, Is set, Is Not Set, Is True, Is False.
  • Rule Action – Actions will be performed when all conditions will be fulfilled in sequence.
    • Call Dialog – Bot executes the dialog definition which is provided in this option. it will be a background process.
    • Redirect to Dialog – Bot redirects to the dialog and starts showing messages of that dialog.
    • Clear variable value – Value of the provided variable will be cleared. it can be used when we want to calculate something again in some condition.
    • Transfer to the agent – Bot will stop and chat will be transferred to Agent.
    • PreChat Form – You can access pre-chat form field values and assign them to bot variables. When you create any custom field in “Live chat transcript” object then that field starts to show in this rule action(Pre chat form) and when you pass any value from your Pre chat form Or Snap-In Script to Live chat transcript Object fields then this rule action can capture those values and you can use them in your bot.


We use entities if we want a customer input in a certain format and for this, we use Regular expressions.
Let’s create a Entity named “CaseNumber” with a extraction type Pattern and RegEx mask  \bC\-\d{4}\b
This indicates an order number must be one word, starting with a letter C, followed by a dash, then ended with 4 numbers.
So the customer can enter values only in this format.


We can create variables of these following types which hold values from the response of customer of Apex or flows.

  • Text
  • Number
  • Boolean
  • Object
  • Date
  • DateTime
  • Currency


We can check bot performance from this section and it shows data in two section


It has certain performance variables when shows bot performance in the dashboard.

  • AVG INTERACTIONS (Per Session)
  • AVG DURATION(Per Session)

Events log

It has ConversationsLogs in which we can see bot execution like what happened in any particular session and if any error occurred then it shows detailed error log with the following attributes.

  • DATE

This helps a lot when any apex, flow action fails and we don’t know what dialog or action actually failing.

Try to build you bot in a way that the customer should feel he/she is talking to a agent 😉

Custom Path In Lightning

Custom Path In Lightning

Path is very cool feature of salesforce when user needs to change picklist values of a record very often like changing status of Lead,Cases.It speeds up the productivity.
But that “cool” feature becomes pain in the ass when you have too many values in your picklist which you are using for path.I had the same problem that picklist values are too many to see whole text of particular picklist value.(See Image)


For this problem I tried to create a custom lightning component and it worked but when I used to change the path status then it gets updated in database but record page still shows the old value bacause it was not refreshed.

Then “Lightning data service” came into my life and everything changed.Now I don’t have to worry about page reload to see updated data in current record page.Yes,Now this is actually a COOL feature.

Here is a github url for code reference :Custom Lighting Path