SFDX: A New Way of Development

SFDX: A New Way of Development

In Dreamforce Salesforce announce a new development tool SFDX. It’s a new way of development where we create a temporary org for the development; In SFDX we call them Scratch org. The idea is similar with Trailhead org where we create new org for challenge and once completed we can delete them as well.


With recent Salesforce releases we are getting updates related to SFDX and as its GA now so I did a quick check to see how it works and how we can best use it. The main part SFDX cover is related to Source control. With SFDX and many VCS (like github) we can easily do version control. SFDX is a command line tool but we can also use Visual studio plug-in to do the development. Today we will cover how we can quickly setup the SFDX up and running.

First you need a Dev Hub org. You can signup for a trial org from here. https://developer.salesforce.com/promotions/orgs/dx-signup

macOS https://sfdc.co/sfdx_cli_osx
Windows 32-bit https://sfdc.co/sfdx_cli_win
Windows 64-bit https://sfdc.co/sfdx_cli_win64
Debian/Ubuntu 64 https://sfdc.co/sfdx_cli_linux

Download the archive from one of the URLs in the manifest, extract the archive, then run the ./install script.

Debian/Ubuntu x86 https://sfdc.co/sfdx_cli_linux_x86

Then we can download CLI from here and we need to make sure we have properly installed it.

Then first we need to do login in our devhub org and authenticate the SFDx  to use that.

sfdx force:auth:web:login -d -a DevHub


You can create alias for org so that it is easy to remember and can quickly type them in CLI. We can use sfdx force:org:list  to see all active org.

First you need to create a local project where you will store all your metadata.

sfdx force:project:create -n MyOrg

mage 2.png


Next we will create a new scratch org where we do all our development.

sfdx force:org:create -s -f config/project-scratch-def.json -a MyScratchOrg

mage 3.png

  • The -s option indicates that we want this scratch org to be the default org for this project.
  • The -f option is the path to the project scratch org configuration file.

We can also export data using SFDX to populate our new org with data.

sfdx force:data:tree:export -q "SELECT Id,Name FROM Account" -d ./data

To Import this data we can use import command.

sfdx force:data:tree:import --sobjecttreefiles data/Account.json

We can also create classes, pages, lightning component using SFDX

sfdx force:apex:class:create -n AccountController -d force-app/main/default/classes

sfdx force:lightning:component:create -n AccountLocator -d force-app/main/default/aura

To Push and Pull data from,to scratch org we use Push and Pull commands.

sfdx force:source:pull

fdx force:source:push

We can use sfdx force:org:open -u OrgAlias command to open any org in browser

To generate password for any scratch org we use the password generate command

sfdx force:user:password:generate -u OrgAlias

We can also get list of all org using list command

sfdx force:org:list

mage 4.png

To get current org details we can use org:display command.

sfdx force:org:display -u MyScratchOrg (OrgAlias)

mage 5.png

So these all are basic steps using which we can easily configure SFDX in no time. In next post we will cover How we can use Git with SFDX and How we can use Visual Studio to develop the SFDX

Did you like the post or want to add anything. Let me know in comments section. Happy Programming. 🙂





Salesforce Einstein Intent: A Quick Overview

Salesforce Einstein Intent: A Quick Overview

Hi All, As Dreamforce is over and there are lots of new things in the market. but Einstein is on top of that. In my previous post I have already shared about Einstein Vision to predict the image. Today we will cover the basic of Einstein Intent A search Prediction.

You can use Einstein Intent to make a case prediction and route the case to different user  so that case can be solved much faster with less human intervention.


The process is same as we have done for Einstein Vision. First if you don’t have API key or access token then you need to create one. You can follow the same steps as previous post.
After that we first need to create sample Dataset. In this step, you define the labels that you want the model to output when text is sent into the model for prediction. Then you gather text data for each of those labels, and that text is used to create a model.

You can use sample CSV which I have used or can create your own as well.

Then you need to train that dataset. You can also make request to check status of training. and once training is completed you can make your first prediction.

The text which I used for prediction is “Why my shipping address is changed.” And the response which I get is

Prediction Result.png


Its related to Billing and it is Correct. You can create large dataset to make these prediction more accurate. And can play with it yourself.

Let me know what you like most about Einstein in comments. If you want to add something share with me in comments section.

Happy Programming 🙂

Salesforce Einstein Vision: Quick Overview

Salesforce Einstein Vision: Quick Overview

Einstein Vision is part of the Einstein Platform Services technologies, and you can use it to AI-enable your apps. Leverage pre-trained classifiers, or train your own custom classifiers to solve a vast array of specialized image-recognition use cases. Developers can bring the power of image recognition to CRM and third-party applications so that end users across sales, service, and marketing can discover new insights about their customers and predict outcomes that lead to smarter decisions.

Einstein Vision includes these APIs:

  • Einstein Image Classification—Enables developers to train deep learning models to recognize and classify images at scale.
  • Einstein Object Detection (Pilot)—Enables developers to train models to recognize and count multiple distinct objects within an image, providing granular details like the size and location of each object.


Today we will cover the Einstein Image Classification . As we have a very good Apex wrapper provided by Salesforce dev team here. Which you can use to make all request of Einstein while it handle all the heavy work in background for you.

But if you don’t want to install a full library to test these requests then I will share quick code sample which you can use to create your own request.

Before we start first you need to make sure that you have completed all prerequisite steps. You need a valid Einstein token to call API and few base classes to make request.

After all this setup our org is ready to make our first prediction. For our demo purpose we will use Bike vs Car model. Here I have commented Token Id, Dataset Id and Model Id you can enter your related Id there.

First  to make a request we need the access token, Here we take help of our base classes which we have included. To get the access token we will use JWT access token helper.


Then we need to make our Dataset: A data set is a folder which contains the images. Here we pass the data in multipart/form-data format.

Dataset can be created Asyn or syn. In our example we are creating Asynchronously.

Next we will train our dataset to identify the images. You will get Dataset ID from previous request.

this command train the Dataset and create a Model. Model creation process takes time based on number of images which you have provided. In our example number of picture is less so it will complete early.

You can also check the status

Once the Dataset is trained we are ready to make our first prediction.

For prediction we will use this image



And the response we get is



So we get Almost 100% for this image. You can make your own Dataset and can play with them.

Let me know what you like most about Einstein in comments. If you want to add something share with me in comments section.

Happy Programming 🙂

Be a Speaker at Dreamforce 16

Hi All, We all know about Dreamforce. Dreamforce is the biggest event of Salesforce in which we get to know lots of things, meet some industry expert and some very great sessions.

Speaking at Dreamforce is a fantastic experience and if you have ever attended, you know that the quality of session speakers is extremely high. If you are thinking for a Dreamforce speaker then here are a few tips and guidelines to give you an idea of what Salesforce looking for.

For 40 minute sessions, Salesforce looking for speakers that:

  1. Have a great story to tell and a passion for sharing your knowledge with others

  2. Provide clear successful use cases, best practices, teachings and how-to’s,

  3. Highlight the ROI and additional benefits your company and team has seen since implementing Salesforce

For our 20 minute theater sessions, Salesforce  looking for speakers that:

  1. Can highlight a tip or trick like “Use this shortcut to save 10 minutes a week”

  2. Tell a great customer success story

  3. Focus and/or highlight a specific feature and how you are using it

  4. A great demo

Here are a few helpful tips for crafting your speaker submission so that you get selected to speak.

  1. Outline your story – what are the key topics or points you want the audience to hear

  2. List and rank your top messages, target personas, target industries.

  3. On the submissions page, be as precise and descriptive as possible.

  4. Also share your past experience and your preference for a 20 or 40 minutes session.

You can do your registration here. All the best :).

Do you have anything to share let us know in comments section.