Tuesday, April 23, 2019

Creating Salesforce Development ready Visual Studio Code IDE

Motivation behind this

Since Salesforce is recommending to use Visual Studio Code (VS Code) IDE for future development platform and not going to support Eclipse IDE after few months, so I was trying to prepare VS environment for my development purpose.

I am already having Salesforce org which has classes, pages, triggers which I want to download in my local system, create a VS project with those files and want to create new classes or components and deploy those from VS Code environment from Salesforce Org.

I have gone through Quick Start: Visual Studio Code for Salesforce Development trailhead module, but it was not able to solve few issues which I have encountered with.

Here are the steps I have followed to setup and resolved all the issues. This might be helpful for others who has not even worked with Java-J2EE platform or never worked with Eclipse IDE.

Step by Step Approach

1. Install Visual Studio Code IDE from Visual Studio Code version 1.33 download.

2. Install Salesforce CLI which is powerful Command line interface.

3.  Install Java SE version 8 from jdk8-downloads and verify Java version.

4.  Open Visual Studio and install Salesforce Externsion Pack, Salesforce CLI Integration,    ForceCode extensions.

5. From Command prompt, sfdx COMMAND. If this command is not recognized by System then verify sfdx file is available under \Salesforce CLI\bin path

6. Edit "Path" environment variable and add full path of "\Salesforce CLI\bin".

7. If JAVA_HOME is not recognized then add JAVA_HOME and JDK_HOME in System variables.

Now, all environment related setup is done.

8 . Let's create a Project (before that create Folder inside Window Explorer), press CTRL + SHIFT + P , choose SFDX:Create Project from drop down menu
SFDX: Create Project

9. System will create project explorer like this

10. Now, let's connect this project with Salesforce org. Click on "No default Org Set" at the bottom or CTRL+SHIFT+P and type SFDX: Authorize an org

Choose, appropriate org, enter org's user name and press Enter, it will open a new webpage for entering username and password and ask you to authorize.

You will see following log details in VS IDE

Now, Let's download all the classes and components available in the org to our project.

Select the Project (For example My Trailhead Project) and Click on CTRL+SHIFT+P and choose ForceCode: Get Class, Page or Trigger.

Then choose all or respective components

Finally, all the selected components will be available in the project.

Let's try to complete this trailhead: Use Visual Studio Code for Salesforce Development

Create a new Class AccountController as mentioned in the trailhead and deploy that in the target org.

Finally, IDE is setup and working.

Related Reference

Thursday, March 28, 2019

Salesforce Lightning Platform Security and Sharing

Motivation behind this

Many a times, I thought of having a single glance of Security and Sharing architecture, but over the net I couldn't find it as a simple single flow. I am trying to portray this flow on best of my knowledge.

In the below flow, I am trying to showcase what the different layers of Platform Security and when a user tries on login to Salesforce what are the various steps come to play. 

After successful login, if that user tries to access the record then how Object level, field level security comes into picture.

Obviously, in a private sharing model, data or record sharing is always in demand and how that can be achievable.

Finally, to showcase transport layer security, if the user wants to send data from Salesforce to external system how different steps occur is good to know.

The following picture might help those aspirants who are preparing for Admin, Sales Cloud and Integration Architecture certifications.

Further Reference

Saturday, March 16, 2019

Sending daily reminders/email alerts before Event Start Date

Use Case

Business has a requirement to send to daily reminders/email alerts from 20 days prior to Event Start Date until event is not complete.


I was answering this question (How to send daily reminders/email alerts before event start date) and thought that it might be beneficial for other too. This kind of use case it also applicable to send birthday wishes to Contacts every year.

Here is the way to solve this use case.

Create a workflow rule based on `Event Start Date > Reminder Date` with other criteria like status is not closed.

Create a time-dependent workflow like `1 hour after Reminder Date`. Here you will send an email and most importantly, update `Reminder Date` field to next date.

System will compares the dates and every day until Event Start Date it will send reminders.

Flow will look like this:

Tuesday, March 12, 2019

Efficient way of dynamically casting SObject to Specific Object to update records

Use Case

Developer has a requirement to typecast specific object type from the name of SObject and try to update record of the SObject.

For example, SObject name is "Account" and Id is ''0012v00002AyZWE''.

Developer wants to update Account Name or other field values.


Create an instance of SObject based on reflection as follows:

  1. String sObjectName = 'Account';  
  3. SObject actObj = (SObject)(Type.forName('Schema.'+ sObjectName).newInstance());  

We can also create an instance of SObject based on global describe as follows:

  1. String sObjectName = 'Account';  
  3. SObject sObj = Schema.getGlobalDescribe().get(sObjectName).newSObject(); 

But, first one is most efficient which executes in 1ms where as second one takes 75ms and may be higher based on number of objects available at our Salesforce org.

So, lets put the desired solution:

  1. String sObjectName = 'Account';  
  2. String recordId = '0012v00002AyZWE';  
  4. SObject actObj = (SObject)(Type.forName('Schema.'+ sObjectName).newInstance());  
  5. actObj.Id = recordId;  
  6. actObj.put('Name''New Account2');  
  7. update actObj; 

 We can easily put that in the list of SObject and update the records in one single goal.

If we have Id of a record then we can create an instance of SObject as follows:

  1. Id sampleid = '0012v00002AyZWE';  
  2. SObject actObj = sampleid.getSObjectType().newSObject();  

So, the entire solution approach will be as follows:

  1. Id sampleid = '0012v00002AyZWE';  
  2. SObject actObj = sampleid.getSObjectType().newSObject();  
  3. actObj.Id = recordId;  
  4. actObj.put('Name''New Account3');  
  5. update actObj; 


From the above approaches which one needs to be followed that truly depends on individual use cases. It's good that Apex provides different ways to typecast SObject to specific object.

Monday, January 21, 2019

Order of Execution - Flow chart

Motivation behind this

Few Salesforce aspirants are learning Salesforce from me and are struggling to remember and visualize the order of execution which starts with a DML operation and there are involvements of triggers, different types of out-of-box automations like process builder, workflows, flows and different rules.

I have prepared this flow chart which could be easy to understand and remember taking reference from Triggers and Order of Execution

Flow of execution


I have shown the field update from workflow, it could be possible that field update can be done from Process Builder or Flow. It will also fire Before update and after update triggers.

So, we should design our system in such a way that, recursion should be eliminated. Otherwise due to recursion there will be unpredictable outcome or duplicate actions could be possible.

It is advisable that, if we have trigger on the object then not to update any field of that object through workflow or process or flows. Those updates need to be handled through trigger itself.

Monday, December 24, 2018

Transform your career to Salesforce Platform

Motivation behind this

Many a times, I have received requests from unknown aspirants through Facebook or Linkedin as to how to get started his/her career to Salesforce, or how to transform their career to Salesforce. 

Very recently, two of my colleagues  who are working on Mainframe for quite a long time and trying to learn Salesforce from me and I am guiding them on day-to-day basis.

I thought that this guidance could be good start for others to follow. The following content is indicative and may vary from person to person and based on their existing skill set.

Let's get started

       The above picture is taken from Salesforce website

2. Visually through some videos from Salesforce University to get started: 

10. Complete Superbadges based on Role that you are going to perform. Here is the link:   Trailhead Superbadges. If you complete those superbadges then you should definitely work on any real-life projects.

11. Have a look into my post Effective Salesforce certification path with preparation time saving options which will guide you about Salesforce certifications based on the roles.

12. Register for certifications at webassessor

13. Prepare your Salesforce based resume and try to get into Salesforce practice at your company or jobs.

And the journey continues.

Hope above approach will help you. For any additional input, please post as comments and I will guide you.

Also, create a twitter account if you do not have already and follow @Salesforce, @Trailhead, @SalesforceDevs, @SalesforceAdmns, Salesforce MVPs, Salesforce success community members, and any member who are passionate about Salesforce. You will really get motivated seeing others' posts and progress.

Be sure to post your progress at twitter and encourage others to learn.


Both my colleagues, completed 100 trailheads within 6 weeks achieving Ranger status and are in a learning path till today.

Here are noticeable achievements recognized by @Trailhead.

Posted by @kingshuk1sarkar

Posted by @Sudipta1ghosh

Many congratulations to both of them! 

Friday, October 5, 2018

Effective Salesforce certification path with preparation time saving options

Motivation behind this

Many a times, I have received requests from my colleagues or friends on what certification to begin with and what certification to write next. After passing 18 Salesforce certifications, I have planned to share my thoughts on the certification path but with preparation time saving with proper direction.

The path will vary from person to person and the roles people are playing at their organization. Since ultimate goal is to reach highest level of certification i.e. Technical Architect, so how a Developer or Administrator could reach that target, I am trying to portray.

Also, I have posted the same in twitter and received numerous likes and retweets. Hope people thought about its usefulness. 

Effective Certification Path

 click on the above image to expand

Legends used

All green boxes are part of System Architect certification
All orange boxes are part of Application Architect certification.
PDI is blue box which is pre-requisite for both Application and System Architect certifications.
Solid arrow is most preferable to go next.
Dashed arrow is optional

Reasons behind effort saving

For example, if a developer wants to go for architect related certification then better to complete PDII which will help for his developer role and after that choose Integration Architect certification. Here the some part of integration related study materials can be reused, specially use of SOAP API, REST API related topics. So around 20% effort saving during preparation. You can say less reading or revision.

Second scenario, if an Administrator wants target for Architect level exams then go for some Consultant level exams and then appear for Sharing & Visibility exam. Since Sharing and visibility topics are quite common for all Consultant level exams so there could be 20% effort saving considering that path.


Hope it will help our community members to reach their own destination. Again, this path will vary based on own target and it is not universal to be followed but it is indicative one.

For all certifications, refer http://certification.salesforce.com/

Wednesday, September 26, 2018

Tips for passing Salesforce Certified Field Service Lightning Consultant

Today (26th September'2018), I have successfully passed Salesforce Certified Field Service Lightning Consultant exam. Here are few tips to pass the exam.

Exam Outline

  • Content: 60 multiple-choice/multiple-select questions * (5 unscored questions will be added)
  • Time allotted to complete the exam: 90 minutes (time allows for unscored questions)  
  • Passing Score: 70%  
  • Registration fee: USD 200, plus applicable taxes as required per local law 
  • Retake fee: USD 100, plus applicable taxes as required per local law 
  • Delivery options: Proctored exam delivered onsite at a testing center or in an online proctored environment. 
  • References: No hard-copy or online materials may be referenced during the exam. 
  • Prerequisite(s):  Salesforce Certified Administrator credential and Salesforce Certified Service Cloud Consultant credential.

I have faced 65 questions and regarding the complexity level it is easier as compared to Sales Cloud, Service Cloud certifications.


I have attended Salesforce training for during month of August and here is following points which I have used during my preparation.

Core Data Model


(above 2 images referred from Salesforce documents)

Topics I have received on Exam

  • Managing assets and preparing BoM (Billing of material) from asset hierarchy.
  • Sequence of configuring Milestones, Entitlement Process, Entitlements, Create Case
  • Entitlement Models (Entitlements only, Entitlements + Service Contracts, Entitlements + Service Contract + Line Items)
  • Configuring and use case of product specific entitlements
  • Use of entitlement templates for predefined support contracts.
  • Customer support interactions through Cases and Work Orders and their life cycle.
  • Use Cases of relating Work Orders to Asset, Account, Contacts.
  • Use case of using preferred resource.
  • Updating Work Order when all work order line items are complete.
  • Updating Case status on work order closure
  • Scenarios of signature capturing at client location.
  • Creating follow up task or service appointment and relating with parent.
  • Attaching knowledge article to work order or work order line item which can be used in client location
  • Use case of maintenance job
  • Work Order process
  • Use case on linking Work Order with Asset
  • Service reports and when to use what
  • Tracking of product consumed, product transfers, shipments
  • Use of operating hours at resource and service appointment
  • Skills and Work Types
  • Scheduling optimization - Scheduling policies (Customer First, Soft Boundaries, High Intensity) which can be changed from
    • Gantt
    • per object for Appointment Booking
    • for optimization request
  • Marking active resources
  • Finding minimum travel from home
  • Work Rules and Service Objectives
  • Global Actions for upsell opportunities
  • Emergency Dispatch configuration
  • Use of Contracts for capacity based resource allocation
  • Use of external workforce
  • Enabling status transition
  • Location Management
  • FSL Mobile Setup - changing color, logo, using knowledge, using quick actions
  • In door service appointment
  • Single and Bulk appointment scheduling
  • Fixing overlaps
Hope, this will help you to prepare for the exam.

Tuesday, August 28, 2018

Tips for passing Salesforce Certified CPQ Specialist

Today (27th August'2018), I have successfully passed Salesforce Certified CPQ Specialist. Here are few tips to pass the exam.

Exam Outline

  • Content: 60 multiple-choice/multiple-select questions * (5 unscored questions will be added)
  • Time allotted to complete the exam: 105 minutes (time allows for unscored questions)  
  • Passing Score: 68%  
  • Registration fee: USD 200, plus applicable taxes as required per local law 
  • Retake fee: USD 100, plus applicable taxes as required per local law 
  • Delivery options: Proctored exam delivered onsite at a testing center or in an online proctored environment. 
  • References: No hard-copy or online materials may be referenced during the exam. 
  • Prerequisite: None required; course attendance highly recommended. 

I have faced 65 questions, some of the questions are descriptive and contained long code script, which took time to read and understand the question. This exam is much harder than any of the Consultant exams.

Above all, it's good to see me passed.


I have attended Salesforce training for Partner during month of June and here is following points which I have used during my preparation.

Refer, CPQ architecture diagram

Refer, CPQ Data Model

Refer, Quote-to-Cash Functionality

Topics I have received on Exam

  • CPQ Product fields - Hidden, Quantity Editable
  • Subscription Products, Subscription Terms, Types of Subscription Pricing and usage, Percentage (%) of Total and its effect on calculation.
  • Proration
  • Subscription Prorate Precision
  • Subscription Term unit
  • Product Bundle
  • Configuration Type and Event
  • Features
  • Option Constraints, Constrained Option, Constraining Option, Type (Dependency, Exclusion) 
  • Numbering for sequence
  • Different types of Product Options (Component, Accessory, Related Product)
  • Percentage of Scope (Package, Component, Both)
  • Product Rule (at-least 4-5 question on this), Evaluation Event (Load, Edit, Save), Type (Validation, Selection)
  • Error Condition Fields (Tested Object, Tested Field)
  • Product Action Fields (Type = Add/Remove, Enable/Disable, Show/Hide)
  • Configuration Selection Rules
  • Create Production rule based on prior Asset.
  • Configuration Attributes
  • Auto-mapping (Twin fields)
  • Hiding options in Configurator
  • Custom actions
  • Dynamic Custom actions
  • Search filters
  • Guided Selling
  • Building workflow to map quote process
  • Pricing Structure (List Price, Regular Price, Customer Price, Partner Price, Net Price)
  • Discount Schedule (Volume, Term, Cost), Type (Range, Slab), Cross Products, Cross Orders
  • Pricing Methods (List, Block, MDQ, Cost + Markup, Subscription Products & Proation)
  • Pricing Rule (Inject a value into Quote or Quote Line Field), Calculator Evaluation Event
  • Summary Variable
  • Quote Template, Template content, Template Sections, Line Columns, Page Break
  • Types of Template Content
  • Use of merge fields
  • Troubleshooting (Like Attempt to de-reference a null object error during previewing a quote template)
  • Renewal Contract
Hope, this will help you to prepare for the exam.

Monday, July 30, 2018

Tips for passing Salesforce Certified Commerce Cloud Digital Developer

Today (30th July'2018), I have successfully passed Salesforce Certified Commerce Cloud Digital Developer. Here is few tips to pass the exam.

Exam Outline

  • Content: 60 multiple-choice/multiple-select questions * (5 unscored questions will be added)
  • Time allotted to complete the exam: 105 minutes (time allows for unscored questions)
  • Passing Score: 70%
  • Registration fee: USD 200, plus applicable taxes as required per local law
  • Retake fee: USD 100, plus applicable taxes as required per local law
  • Delivery options: Proctored exam delivered onsite at a testing center or in an online proctored environment. Click here for information on scheduling an exam.
  • References: No hard-copy or online materials may be referenced during the exam.
  • Prerequisite: None
I have faced 65 questions, some of the questions are descriptive and contained long code script, which took time to read and understand the question. 

Above all, it's good to see me passed.


You need a sandbox and access to Commerce Cloud Account Manager. If your company is Salesforce Partner then requesting to Salesforce will have access.

Topics I have received on Exam

  • How to connect sandbox from UXStudio.
  • Lot's of question on Import and Export, (including Site, Product etc)
  • What are different type of includes and for which purpose it is being used. Read on <include>, require()
  • Content Link functions like $url()$, $httpUrl()$, $httpsUrl()$, $include()$
  • Different types of scopes like Session, Request, Page and when to use what.
  • How to show error message when required mandatory input has not given.
  • How to create an instance of custom object.
  • Write a correct code to show Debug message.
  • Log file formats.
  • Accessing values for multi-lingual requirements.
  • Creating and using custom tags.
  • CSRF and how to prevent those.
  • Quota and what happens when it is exceeded and what needs to be done.
  • Cache: how to define cache
  • How to identity the cache related issues.
  • Creating custom attributes and how to make it indexed.
  • Open Commerce API (OCAPI) and calling webservices using SOAP, REST etc.
  • Correct syntax using GET and POST with authentication.
  • Hooks: Which hook needs to be used given a certain use case.
Hope, this will help you to prepare for the exam.

Wednesday, July 25, 2018

Engaging and working on Ideas using Salesforce

Use Case

I was answering this question End user adoption/understanding in Stackexchange and thought of having this use case. 

Usually the project team has an idea and they build a few features, alerts, dashboards, etc.
Yet, vendor often see that end users do not always understand everything we built. Vendor has noticed that his notes/guides tend to be somewhat technical, but maybe he should build some sort of knowledge base that tells the user 'alert 1' does XYZ.
How do you tackle it?

Probable approach

  1. If vendor has an idea then post this idea in chatter and get votes on this idea. Also, vendor should make sure users are adopting Chatter quite well, otherwise, ideas will not reach to the broader audience.
  2. Before actual implementation, vendor needs to engage your user on what you are planning to implement and how business will get benefited (either by, improvement of productivity, cost etc.)
  3. Show and Tell approach - Vendor can create a mock application to show customer and get customer's feedback and confidence.
  4. After implementation, vendor should create a Knowledge article, so that business can understand the effective use of the use case or need. Knowledge article should be readable and sometimes use of context sensitive pictures and flow charts helps users the understand the context.
  5. Easy access to the Knowledge article, so that when customers need it they will have it.
  6. Engaging them in Chatter when vendor comes up with this implementation.
  7. Taking feedback periodically, how Customers are using this feature and what's their suggestions for future improvements.
  8. Build continuous improvement process at your organization.

Sunday, July 8, 2018

Displaying lightning:radioGroup dynamically from SOQL query

Use Case

Sometimes we receive a use case to display dynamic radio button with dynamic options querying the data from database via SOQL query.

Let's say, questions and answers to be populated and displayed in lightning components.

I was answering this question lightning:radioGroup - not able to select the options in stackexchange and able to produce a small poc with an approach.


Create Question and Answer custom object with following attributes.

Question Object (Question__c)
  • Question Name (Auto number)
  • Question Text (QuestionText__c, TextArea(255)).
Answer Object (Answer__c)
  • Question (Master-Detail (Question)
  • Option (TextArea (255))
  • Correct Answer (Checkbox)
Following things to considered when implementing this solution:

  1. To group the options for individual question, the name should be unique. Here QuestionText has been used. You can use QuestionId.
  2. We can see in the reference Radio group in Lightning Component Library that options attribute takes label and value as follows. So we need to pull the options as AnswerText__c from Answer object and assign those values as label and value.

    <aura:attribute name="options" type="List" default="[
    {'label': 'Sales', 'value': 'option1'},
    {'label': 'Force', 'value': 'option2'}
    <aura:attribute name="value" type="String" default="option1"/>

    <lightning:radioGroup name="radioGroup"
                          label="Radio Group"
                          options="{! v.options }"
                          value="{! v.value }"

So, the component code will look like this.


 <aura:component controller="QuestionAnswerClass" access="global" >  
      <aura:attribute name="Questions" type="List"/>  
   <aura:attribute name="radioGrpValue" type="List"/>   
   <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>  
   <aura:iteration items="{!v.Questions}" var="ques">  
     <lightning:radioGroup name="{!ques.QuestionText__c}"  
                           label="{! ques.QuestionText__c}"   
                           value="{! v.radioGrpValue}"  


 doInit : function(component, event, helper) {
  helper.doInit(component, event,helper);       


 doInit : function(component, event, helper) {
  var action = component.get("c.getQuestionAnswers");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var returnVal = response.getReturnValue();
                var finalList = [];
                for(var i=0; i<returnVal.length; i++)
                    var answers = returnVal[i].Answers__r;
                    //append label and values into the list so it can be displayed as options
                    for(var j=0; j<answers.length; j++)
                        answers[j].label = answers[j].Option__c;
                        answers[j].value = answers[j].Option__c;
                component.set("v.Questions", finalList);
            else {
                console.log("Failed with state: " + state);
        // Send action off to be executed

Apex Controller

public class QuestionAnswerClass
 public static List<Question__c> getQuestionAnswers()
  List<Question__c> lstQues = [SELECT Name, QuestionText__c, 
     (SELECT Name, Option__c, Correct_Answer__c FROM Answers__r)
     FROM Question__c];
  return lstQues;


<aura:application extends = "force:slds">

Desired Results

If we load the application clicking on preview, it will display like this.

User can see the dynamic questions with options and able to select options respective to questions.

For more information, refer Radio group in Lightning Component Library