Thursday, November 14, 2019

Quick Tips: Setup SFDX Manually without Admin access

We all have faced challenges while working in different enterprise environments, where there may be lot of controls/ checks/ red-tape to get by. In such situations, getting access to simple tools (even git) can take lot of time.

Note: This tutorial is to be followed at your own risk, as it may not be complaint to your organization's IT policies.

What is SFDX?

SFDX is a command line utility for managing salesforce builds/ deployments. Being command line, it can be easily embedded to automation chains, to help build fully automated build and deployment processes. To get started, refer

Setup SFDX on Windows machine without admin access

As you may have already realized, SFDX installation needs admin access to one's machine. Which may be a luxury a lot of developers may not have. So, i tried to provide a step-by-step guide to setup SFDX on your computer without any admin access


Note: The path in commands is provided only for guidance. Ensure, you are using right path, as per your machine's folder structure
  1. Download latest NodeJS Zip file package (v13.1 -

  2. Unzip folder to desired location. Say \Tools\nodejs
    1. Note: zip extraction may generate the folder name as per nodejs packaging. In my case, the path was \Tools\nodejs\node-v13.1.0-win-x64

  3. Open command prompt (Win + R; type cmd and press enter)

  4. Within command prompt navigate to nodejs path (ensure to use correct path no your machine)
    cd Tools\nodejs\node-v13.1.0-win-x64

  5. Test if NodeJS works fine. Type following command in command prompt
    node –v
    Should display version of nodejs for e.g. v13.1.0

  6. Run nodevars to setup local variables

  7. Install sfdx command line using NPM (comes along with NodeJS)
    npm install sfdx-cli –global

  8. Voilla!! This should result in successful installation of sfdx on your desired folder. To test run this command
    sfdx –v
    It should result in sfdx version for e.g.
    sfdx-cli/7.33.2 win32-x64 node-v13.1.0

Note, this does not install sfdx as a global utility i.e. to use sfdx, you have to always provide an absolute path (\Tools\nodejs\node-v13.1.0-win-x64\sfdx) to run the command. However, it does allow you to use SFDX on your machine.

Wednesday, January 23, 2019

Time to Migrate from Salesforce IDE to VS Code

Image Credit: Visualstudio marketplace


In case you don’t know Salesforce is phasing out IDE (planned for June 2018) to promote newer IDE choices. There are already many IDEs out there to take Eclipse based IDE’s place. However, Salesforce is officially promoting Microsoft Visual Studio Code (aka VS Code) as official IDE.

What is VS Code?

VS Code is a platform-independent, light-weight and keyboard focused IDE for Salesforce (sorry for folks who loved menus and GUI). VS Code does have visual menus and options, however, using keyboard shortcuts is just do damn fast. There is surely some learning curve involved. But, once you get rolling, you would hate using mouse, as it takes a lot of work to raise your hand, move mouse, point and click and navigate, when you can just press “Ctrl + /” to comment current code selection.

VS Code features

  • Lightweight – In case  you have worked a lot with Eclipse, you might have noticed that it was a memory hogging tool. To much relief, VS Code is a comparatively very lightweight
  • Fast – I remember there were times in large projects, where we waited for minutes to allow Eclipse to load properly. Thankfully, with VS Code you would have minimum such encounters (if any). Primarily, due to it’s lightweight model and lazy loading of extensions, it ensure it’s just loading the things, that your project needs. Others, will be loaded on demand
  • Inbuild GIT capabilities – This was one of the most profound experience I’ve had in using GIT in a development IDE (others may have had better experiences). But, the sheer ease of using GIT within VS Code is ecstatic. Whether it’s about identifying current branch, items to pull from remote, items to push to remote server, files changed. It’s so ingeniously baked within user interface that you would wonder why it wasn’t done in other IDEs.
  • Intellisense - VS Code packs amazing intellisense capabilities, so you don't need to remember all variables or classes it displays a list of available values for you to choose
  • Shortcuts, Shortcuts and Shortcuts – VS Code is heavy on shortcuts and allow users to configure custom shortcuts to increase personalization.
  • Addons/ Plugins – like Eclipse, VS Code has a vibrant community of developers publishing plugins / add-ons to add more features to VS Code. There are plugins for almost all usual needs and specific needs as well
  • Platform Independent – VS Code supports Windows/ Mac/ Linux. This can be very helpful in particular when you have team members using different mix of machines
  • Language Agnostic – This is beauty. Doesn’t matter if you work on Lightning components, Apex, Visualforce, NodeJS, PHP, C# (obviously) or any other programming language/ technology, it is most probable supported (natively or extensions). So, no switching between different IDEs, when you are you have a backend NodeJS server running on heroku
  • Fast Coding and Refactoring capabilities – being the new kid on the block, VS code gets advantage of adopting time proven best practices, tips and tricks to ease day to day life of developers and help them become more productive. Common things like searching a particular text in all files, or paragraphs within in all files, or replacing variable name in entire class, it can be done like a breeze.

Myth vs Reality

  • It’s only for SFDX based projects – Well that’s a big misconception, something a lot of people have asked about. VS Code can be used for both SFDX and non SFDX based projects. It really boils down to the extensions you would choose.
  • It’s too complicated (no GUI) – it certainly has a learning curve for folks who have used GUI heavy IDEs. They can start by using available GUI / menu options. Also, as you'll find below, there are extensions which provide rich menu based development features (check Forcecode)
  • It’s too Dark – Unless you are afraid of darkness, dark theme helps in saving energy and your eyes. You can still choose to switch to one of many available themes

How to get started?

It’s simple. Follow these steps:
  1. Download and install VS Code
  2. Install plugins (you’ll need some plugins for Salesforce development)
  3. Get Started

Extensions (plugins) Recommendations

  • SFDX extensions - natively provided by Salesforce and officially supported. These tools are and should be foundational platform for all Salesforce extensions.
  • Forcecode - one of the most prominent development extensions on VS Code (at least prior to SFDX). I prefer it for conventional development, as it provides true IDE features like menu based retrieve, deploy, execute script, update on save etc. 
  • GitLens - parsing old git logs and commits can be tiring sometimes. GitLens solves this by providing intuitive features like inline commit view, last version comparison etc.
  • To-do Tree - if you utilize best practices of inserting to-do in code, for later reference, this extension can ease up the process of finding all todos 
  • Apex PMD - Static code analysis for your Apex and Visualforce code

Friday, December 14, 2018

Sneak Peek: Lightning Web Components

With latest announcement of Lightning Web Components, Salesforce development ecosystem (Lightning Platform) moves one step closer to using web standards of UI development. It is definitely quite welcome move, as it helps in learning and utilizing skills which are not confined to Salesforce ecosystem.

You must read this official Salesforce blog post to get more background details on why and what of lightning web components.


User interface development has evolved drastically in past decade. With introduction of AngujarJS (2010), javascript based front end development became more modularized and then with React (2015) it became much faster, lightweight and component driven. So, front end layer is no longer confined to lightweight ui and graphics. Instead, with Single Page Applications (SPA), you can have pretty much an entire application running on browser (serverless).

Web Components

"Web Components is a suite of different technologies allowing you to create reusable custom elements — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps." - Mozilla

In short, prior to web components, one had to utilize an external library/ framework (like Angular, React etc.) and build your application on top of it. So essentially, your application runs on top of the external library/ framework and which in turn runs on the browser.

With latest innovations within web development world and addition of custom elements, shadow DOM (don't confuse with virtual DOM), and content template element, browsers are now equipped to execute custom web components themselves, without needing any external library.

It can be related to running a video using HTML video component vs using Adobe Flash for running videos (not quite literally).

Lightning Web Components

Lightning web components, leverages these new web standards (or browser improvements) and allows developers to create web components which can work within Salesforce Lightning platform.

Remember, web components allow you to combine UI and processing. To create a web application, you still need security, access to server services/ data. This is where Lightning web components come into place. Salesforce Lightning web components provides these additional capabilities (security, lightning data service). With these, we can create standard web components which can interact and work with Salesforce Lightning platform.

Additionally, lightning web components can leverage lightning base components (already built on web components), enhancing overall application performance.

Lightning components vs Lightning web components


Similar to custom lightning components, lightning web components can be utilized to create standalone components which can be embedded within
  • Lightning Applications
  • Custom lightning components
  • Visualforce page (using lightning out)
  • Lightning components *
* Info: I am able to embed lightning web component within a custom lightning component and then embed this custom lightning component within lightning community page. Awaiting more details around LightningComponentBundle targets

Custom Lightning Components vs Lightning Web Components

So, what is the difference between Custom Lightning components (something that has taken a significant portion of everyone's time in past 3-4 years) and Lightning Web Components. One word answer is Framework.

Lightning components utilize Aura framework for development and execution of Lightning components. Aura framework can be placed in same stack as Angular, React, as it provides the nuts and bolts to run your lightning components.

Lightning web components, on other hand utilize browser provided features for general component scaffolding along with Salesforce Lightning web components framework (which provides features related to security, service integration and base lightning components). As a large portion of this is now native within browser, there is an obvious cost saving in terms of processing overhead.

To put it simply, in above infographic, the blue blocks represents the custom layers running on top of browser (javascript engine) to make a lightning components work. In middle-left you can see a big chunk which represents Aura framework (custom). On middle-right, the orange block, represents the web component implementation within Browsers (native).


As lightning web components utilize more of native browser features and capabilities they are:
  1. Compliant to web standards
  2. Lightweight
  3. Memory efficient
  4. Fast
  5. Easier to learn and Transferable knowledge


For most part, all mainstream browsers support these web standards. However, there is still come catching up to do. For e.g. Edge still do not fully support all these web standards (totally clueless about IE's support for these standards). So, if your organization still uses one of the older browsers or older versions, Lightning web components may not be useful right away.

(Update Dec 15): As pointed out by Diego Ferreiro Val, Lightning web components works on all mainstream browsers, down to IE11.

For more details on browser support of web components, refer

Open questions

There are still some unanswered questions here:
  • As we know Lightning Experience itself is built on top of Aura framework. Is Salesforce planning to re-write entire Lightning experience with newer Lightning web components? I'm sure the additional performance and memory efficiency will be more than welcome
  • Would lightning web components become latest de-facto of publishing packages on AppExchange?
  • More importantly, with server side rendering of visualforce pages and client side handling of lightning web components, can there is a mixed model to utilize best of both the worlds?
  • Most important, would it help load lightning experience home page faster? (pun intended)

Further Learning

For most part, as Lightning web components utilize HTML web components, documentation for that can be found fairly easily.

Following are few learning resources:

Saturday, December 1, 2018

Lightning: Generate PDF within Lightning Experience with Salesforce Data

Some time back I posted a solution to generate PDF from Lightning components using in-memory data.
Post url:

It was developed for a specific scenario, wherein we need to generate PDF where:
  1. User interface is Salesforce classic
  2. Initiated via Lightning Component
  3. Data doesn't exist within Salesforce and is completely in-memory
As complex and tricky this situation was, we did end up finding a stable and equally tricky solution.

However, I realize that there are still lack of solutions (or maybe my search skills are downgrading) to generate and automatically download PDF document from Lightning Experience, without using any lightning components, wherein data exists within Salesforce. You can use the earlier solution in that case, but it will be an overkill.

There are various solutions available to generate PDF from javascript. But, I still think the plain old method of converting HTML to PDF (via visualforce PDF generation utility provided by Salesforce) is a better solution, due to sheer control over the end result.

So, I ended up creating another quick solution to generate PDF documents from Salesforce.

Generate PDF within Lightning Experience with Salesforce Data

This simple solution entails adding a custom action to an object and embedding the button within object view.

  1. Create a visualforce page with page attribute renderas = "pdf" (sample code below)
  2. Add a Quick Action "Generate PDF" for required object:
    • Action Type: Visualforce
    • Visualforce Page:
  3. Go to Lightning App builder to add the action to detail view of Object


Automatically download PDF from Lightning Experience

Now, the above solution does allow you to generate PDF. However, it's not a good user experience. Wouldn't it be better, if the PDF is automatically downloaded with a defined name.

  1. Create new page to initiate PDF page download (code below)
  2. Modify quick action "Generate PDF" created in previous step and set Visualforce page to
That's IT!!


Thursday, November 15, 2018

SFDX Utility - Easy to use Command Line Wizard

As you would already know, SFDX is Salesforce utility for improved build management and development activities. It is definitely a big leap in terms of bringing Salesforce development practices in line with common delivery and development processes.

However, I believe non-admins, new developers and most of folks who love browser based development will be puzzled, as they now have to move to a not-so-good-looking command line screen to run their commands. Not to mention, they need to remember these commands and all their options.

Who is it for?

This utility (currently) caters to teams/ developers who are yet not using scratch org for their development. I consider you are familiar with managing package.xml to ensure you have your build manifest ready.

What is the need?

  1. Eases pain of entering common development commands (retrieve, deploy, build)
  2. With one time config, you'll be sure you are not messing up with instances
  3. Ensure you or your team follows same process

What does it do?

  1. Retrieve - it performs following steps for each retrieve cycle
    • retrieves components, as per src/package.xml file
    • unzips zip file generated by SFDX
    • copies downloaded components to src folder
    • deletes temporary files
  2. Deploy - allows user to specify username for instance
  3. Test Build - runs a quick validation deployment on a pre-defined build environment/ sandbox

Technical Details

This utility is a windows batch script and tested only on Windows 10, but should work on older windows machines as well (unless you are still using windows 95).

This is a command line utility available for:
  1. Windows machines (tested on Windows 10) - use ctksfdx.bat
  2. *Nix machines (tested on Linux Mint 18.02) - use


Follow these instructions for each client/ project setup, and you'll not have to enter long SFDX commands again and again.


(This setup is to be repeated for each client/project)
  1. Copy utility within project folder (
  2. Setup configurations within utility (explained below)

Example folder structure

Configure utility

Within configuration section of utility (batch file) setup following:
  1. DEV - define username of development sandbox (line no. 13)
    SET DEV=
  2. BUILD - define username of build test sandbox (line no. 16)

Optional settings:
  1. Retrieve wait period - setup time interval in minutes, utility should wait for retrieve operations to complete
  2. Deploy wait period - setup time interval in minutes, utility should wait for deploy/ built test operations to complete

How to use it?

Remember, this is to reduce complexity and effort for repititive tasks, so all you have to do is fire command ctksfdx

That's it!! 

Utility will give you options to choose.

Remember, to keep it really simple and safe, deploy option needs you to provide username of the org where you want to deploy.

[Update Nov 21, 2018] Added shell script utility for *nix systems.

Friday, November 24, 2017

Quick Tips: 6 Hidden Salesforce Gems you may not be using

Salesforce is undoubtedly a leader in cloud CRM and has an immensely rich set of features and capabilities. Yet, I've come across several Salesforce customers who are not quite familiar with all the capabilities of Salesforce. As I see it, it not only shadows the value that an organization can get from its Salesforce investments, but sometimes it also leads to additional costs or delays. Not to forget, you are probably already paying for some or all of these features, but may not be using them.

So, here is a quick list of some awesome Salesforce features which are sometimes overlooked, but are worth looking into. Do keep in mind that some of these feature depend on user licenses and Salesforce instance type you are using. For more information refer to Salesforce documentation to get complete information on these features. Sites

Do you know you can host a whole website (yes public facing) from within your Salesforce instance. It's often not marketed a lot currently. But, it is truly available with really cool features like:

  • URL Rewriter - helps you to setup readable (search engine friendly) page URLs, instead of having page URLs embedded with record id
  • Website analytics - simply provide a Google Analytics tracking code and have complete analytics out of the box
  • Seamless data access - being hosted by same salesforce instance, you have the flexibility to display your data


In today's world, I don't think there would be many people in the business world who don't use a smartphone. To give it it's worth, it is a handy tool and definitely enhances productivity (unless you indulge in other wasteful activities). Salesforce allows it's users (license needed) to download and install its mobile app on your smartphone (iOS and Android). With that you can connect to your specific salesforce instance, view/ create/ update your data right from your mobile. It definitely helps to ensure that you have access to your data when you are on the move. Following are few nifty features:

  • Analytics - you do get those beautiful dashboards within mobile as well
  • Calendar - can view all your 
  • Chatter - helps you to collaborate with your teammates and ensure you don't miss out on any updates
  • Offline data access - probably the most undermined feature. This helps you to access your data, even when you don't have an internet connection. You would definitely not know it's importance until you need it

Analytics Snapshot

We often create beautiful reports within Salesforce and share meaningful data insights with business. However, one of the pain points is that all the reports we see within salesforce are transactional i.e the reports are driven by the records that exist within Salesforce.

Analytics snapshot provides us the capability to take a snapshot of a report data as per defined interval and then use it for future reporting needs. So, even if the original data is no longer within salesforce, your reports can still show those details (from data stored within analytics snapshot). It is a very handy tool when you have to deliver trend reporting or even some general reports which need data from extended time periods.

Service/ Sales cloud console

I'm sure you would have at least heard about it, if not using it already. I wanted to include this feature in here, as I consider that this is one of the most important feature for sales/ service users when it comes to enhancing user productivity. In short, it is a "rapid action screen, to access more data faster". Some of its features and hidden pearls within it are:

  • Tabs - access multiple records at same time via tabbed interface
  • Highlights - access key information at top of the record, without having to scroll down
  • Quick actions - allows you to access standard and custom functionalities like live agent, knowledge, recent items, CTI (Computer Telephony Integration) from one screen
  • Macros - pre-define most used actions with keyboard combinations. You would not realize how handy it is to close a tab by pressing "C" instead of moving a mouse to close button and click on close button
  • Sidebars - When you think you are short of screen space, you can have sliding sidebars popping in from left and right, to show that additional piece of information you may need, without having to switch a browser tab
  • Custom components - (this is one is powerful) Salesforce lets you create your custom console components and embed them within Sales/ Service cloud console. We built a nifty notification tool, equipped with push notification and highlight mechanism to mass alert entire call center in case there is some information to be broadcasted


This is also considered as the secret sauce of Salesforce's early success. A very simple yet elegant tool to allow your customers to speak to you and let them know that they are being listened. Salesforce has really learned and implemented really cool features submitted as ideas by the community. It does its customers to use ideas for their clients as well. So, as an organization, you can enable IdeasExchange of your own wherein you can accept new ideas, evaluate them and then progress them as needed.


We all want to have completely streamlined and automated processes wherein the data is flowing efficiently towards its logical closure. For instance, in Sales, we want the leads to start flowing as soon as we receive them and progress them to closure or like in Customer Service, you would like to automatically route incoming customer service requests to agents and bringing them to closure, without any delays. A few years back, such requirement was delivered via AppExchange apps or creating custom functionalities.

Recently, Salesforce launched its Omni-channel feature which provides the capability to automatically route required records (standard as well as custom) to required agents, while allowing you to specify various rules:

  • Agent selection can be done based on most available agent or 
  • Work assignment can be based on work characteristics/ nature by assigning a specific weight to a record, you can ensure that you do proper load balancing within a team
  • Prioritize work on basis of nature/ channel

Bonus, one more point, which may not be that unknown, but definitely quite underestimated. I added this additional point to emphasize it's importance in maintaining a truly stable and robust Salesforce environment.


Last but not the least. Most of the Salesforce developers know about sandboxes as that is where they can develop their custom functionalities. However, quite often I've seen Administrators making changes to live environment. However enticing and powerful it may seem, it is definitely not a recommended approach. Imagine, you adding a validation rule for one team, which disrupts processes for other teams. It's not impossible and happens more time than you may think.
So, as I always like to say, better safe than sorry.

Sandboxes can be considered as test instances of Salesforce. They can be created from a production org and on creation, they include all configurations, settings, and code from production. There are various types of sandboxes which serve different purposes. As a good practice, it's always recommended to make any changes to a sandbox first, test and verify them and only upon thorough verification, deploy changes to production. Following are currently available sandbox types:

  • Developer - Most basic of it all, used for code/ configuration development. Data storage limit is 200MB.
  • Developer Pro - Same as Developer but data storage limit is 1GB
  • Partial Copy - Allows you to copy some data from production instance. Data storage limit is 5GB
  • Full - Brings all production data to the sandbox. Data storage limit is same as that of your production instance

Popular Posts