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. 🙂





Lightning Events: Detail Overview

Lightning Events: Detail Overview

In my previous post I have explain the Lightning Basic. But I in that post we only cover basics of Lightning events. I think Lightning events are more complex and need a detailed separate post. So today we will cover lightning events in details.

Events are used in Lightning to communicate between two components and pass data between them. In Lightning we have two types of Events:

  1. Component Event
  2. Application Event

Component Event: A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.

Here’s the sequence of component event propagation.

  1. Event fired—A component event is fired.
  2. Capture phase—the framework executes the capture phase from the application root to the source component until all components are traversed. Any handling event can stop propagation by calling stopPropagation() on the event.
  3. Bubble phase—The framework executes the bubble phase from the source component to the application root until all components are traversed or stopPropagation() is called.

Create Custom Component Events

We can create a custom component event with file .evt. Events can contain attributes that can be set before the event is fired and read when the event is handled. Use type=”COMPONENT” in the tag for a component event. For example, this c:compEvent component event has one attribute with a name of message.


<aura:event type="COMPONENT">

<!-- Add aura:attribute tags to define event shape. One sample attribute here. --> <aura:attribute name="message" type="String"/>


Fire Component Events Fire We can fire the Component event to pass date to other component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.

Register an Event A Component first register a event which he will fire. Value of the name attribute is used for firing and handling events. Fire an Event To get a reference to a component event in JavaScript, we can use cmp.getEvent(“evtName”) where evtName matches the name attribute . And we need to  Use fire() to fire the event from an instance of a component. For example, This is similar as action attribute in apex:actionfunction.

var compEvent = cmp.getEvent("sampleComponentEvent");

// Optional: We can also set the data in attribute which we need to pass

// A parameter’s name must match the name attribute of one of the event’s tags

// compEvent.setParams({"myParam" : myValue });


Handling Component Events

A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event. For example: The name attribute in must match the name attribute in the tag in the component that fires the event. The action attribute of sets the client-side controller action to handle the event. The event attribute specifies the event being handled. The format is namespace:eventName

<aura:handler name="sampleComponentEvent" event="c:compEvent"

In my next post we will cover the Application event and some difference between these two.

Do you have anything to add please 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 Summer 17: Cool Seagulls in Summer

Hi everyone, we all know Salesforce release 3 updates for its system in a year.  Now Salesforce recently launched Summer 17. Summer is hot and in Rajasthan it’s very hot.  So here are few hot and exciting updates for everyone.


  1. Use Advanced PDF to Render Visualforce Pages as PDF Files (Pilot)

Advanced PDF renders Visualforce pages as PDF files with broader support for modern HTML standards, such as CSS3, JavaScript, and HTML5. This change applies to both Lightning Experience and Salesforce Classic.

To use Advanced PDF, set renderAs=”advanced_pdf” in the tag of a Visualforce page with API version 40.0 or later. This process is similar to the existing process for rendering a Visualforce page as a standard PDF file.

PDF pages rendered with Advanced PDF are subject to the same limitations as legacy PDF pages, including the maximum page size and limited number of fetched resources. Advanced PDF pages also time out after rendering for 2 minutes, which includes asynchronous processing time.

  1. Roll Back Changes in Your Org When Remote JavaScript Methods Throw Exceptions

When a JavaScript method in an Apex class calling a remote action throws an exception, the action isn’t completed. Previously, when a method threw an exception, the action was completed.

For example, when you created an Apex class that used a remote action to add an account to your org and that method threw an exception, the account was added. Now, the account isn’t added. With this enhancement, JavaScript remoting methods that throw exceptions no longer cause changes in your org. This change applies to both Lightning Experience and Salesforce Classic.

  1. Cache Operations Supported in Visualforce Controllers

Cache operations made using the put and remove methods in the Cache Namespace are now supported in constructors and getter methods of Visualforce controllers.

  1. New Option for Parallel Testing on the isTest() Annotation

Use the @isTest(isParallel=true) annotation to indicate test classes that can be run in parallel and aren’t restricted by the default limits on the number of concurrent tests. This makes the execution of test classes more efficient, because more tests can be run in parallel.

  1. Deploy Changes Now Trigger Recompile of All Apex Code

All of an org’s Apex code is now automatically recompiled before completing a metadata deploy, a package install, or a package upgrade.

Previously, a deploy, install, or upgrade left the org with invalidated code, which sometimes caused recompilation errors when many Apex transactions occurred. This change in behavior improves performance following metadata deploys and package updates.

  1. Disable Access to Non-global Apex Controller Methods in Managed Packages (Critical Update)

This critical update corrects access controls on Apex controller methods in managed packages. When this update is enabled, only methods marked with the global access modifier are accessible by Lightning components from outside the package namespace. These access controls prevent you from using unsupported API methods that the package author didn’t intend for global access.

Prior to this update, non-global methods (that is, Apex controller methods that weren’t marked with the global access modifier) could be accessed by Lightning components outside of the package namespace.

  1. Metadata Access in Apex

If you’re an ISV creating apps that use custom metadata components, you can now access     metadata using Apex. This change applies to both Lightning Experience and Salesforce Classic.

During or after an install (or upgrade), your app can create or update metadata to let users configure your app. Use the new Metadata namespace for accessing metadata in Apex code. The Metadata namespace contains classes that represent metadata types and components as well as classes that let you retrieve or deploy metadata components in the subscriber org.

  1.   Salesforce Integrations: Taking Salesforce to the Next Level

Now you can connect Salesforce with Skype for Business , Gmail, Google Calendar and Microsoft Office 365. They are generally available in both Lightning and Salesforce classic. Nut some of them are only available in Lightning.

  1. Einstein Vision Is Now Generally Available

Sign up for Einstein Vision to receive 1,000 free predictions per calendar month. If you need more predictions, you can purchase them.

Getting an Einstein Platform account is the first step to accessing the API. Use the sign-up page to get an account. You can get an account in two ways.

  • Heroku—When you provision the Einstein Vision add-on, an Einstein Platform account is created for you.
  • Salesforce—Log in with your Salesforce credentials and create an account.

After you create an account, you download your private key file. Use this file to create an access token.

You can also try your hand on a Trailhead project to understand it better.

  1. Removed LockerService Restriction on instanceof in JavaScript

    Previously, Salesforce advised against using theinstanceof operator in JavaScript code when LockerService is activated. This restriction has been removed, except when checking arrays.

There are many more other update related to Lightning and Einstein. As I am also reading them in more details so I might make another post for them in depth. This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release.

Sign up now for a pre release org.

You can read release notes here. Let me know if I missed something here or if you want to add something then let me know in comments section.

Salesforce + Drucker School, A must read Trail

Trailhead is always fun to learn. Salesforce regularly updates the trailhead modules, adds new challenge and add new rewards as well. Recently Salesforce launches superbadge concept in which you can show your talent using them. But recently Salesforce launches a new module “Learn Drucker School MBA Essentials” .

Because Salesforce is a customer centric company and Drucker School is a management school based on the cornerstone idea that the purpose of an organization is to create and keep a customer. So now they both combine their hands and make a module in which user learn how to keep their customer happy and implement all the requirement in Salesforce at the same time.

Using this module you will learn what are the key points which we should keep in mind when we create something for our customer and at the same time we can implement that in Salesforce so that at the end we can make our customer happy. Because a Happy customer is the key of success and you will never fail if your customers are happy and they are with you. So you should check this trail.

This module is divided into five parts and it’s a short one (So go ahead and try this). So this module uses the MBA course curriculum and implements them using some real life scenario and implements the requirements in Salesforce.



This is a great knowledge which everyone should have to keep their customer happy and at the same time help their business grow much faster. This module uses Five points theory  of Five questions we should ask to our self to understand the customer requirement  and the questions are What is purpose, Who is our target customer, what do our customer value, what are the results and what are the plans. Based on these five questions you can easily find that what your main purpose of developing any solution and who will use it. This will help us to understand who is our audience is and what they really need and we are delivering the same product for which they have asked. And will we ever get the response which we have expected also if there are some existing products in market so will customer buy our product. Then the most important part is what the end result is and what our future plans are to handle the results.

At the same time we can implement all these functionality in Salesforce like if its a customer portal where they ask for some help then we can use Service cloud, If we want to sell something then sales cloud, If we want to go with mobile then app cloud or process the data then we will use the Analytic cloud and wave. Then we can use many Salesforce inbuilt tools like Workflow and process builders for automation of email sending, Fields updates, outbound message to communicate with external servers and Task to notify peoples, Approval process for Approval functionality , Console for easy handling of Case and CTI and call center to implement call centers in Salesforce or Marketing cloud to handle all the current marketing skills, Analytic cloud to generate and process on Data and create reports or App cloud to inbuilt support of App development on All major platform and because future is mobile ready so your solution will be future ready itself or can use the newly addition Lighting to get the better UI experience for the customer.

If I cover all the points then this post will never ends so better part is just and complete this module and did I informed you that 500 early birds will get a certificate from the Drucker MBA schools. Great news isn’t it so hurry up and share your badge and the certificate with the world. All the best 🙂

Salesforce Trailhead, New trails are here

Salesforce Trailhead, New trails are here

We all are aware about trailhead. It’s an amazing platform with lots of amazing things. We can learn cool stuff there. Also recently SF announce that we can display our badge at Success community profile. Recently Salesforce announce 8 new badge and increase trailhead family. I am eager to earn them so you are that’s why you are here. So lets start, get some base idea from earn and increase your count.

Introduction to Service Cloud

Service Cloud is a customer service and support application. It helps keep your customers happy and your support team sane, whether your customers reach out to you by email, phone, social media, online communities, or real-time Web chat. These different ways of reaching out are called channels, and they help you help your customers through their preferred communication tool. Giving your customers a choice in how they communicate with your company is the first step towards delivering extraordinary service. Because customer is the key of success. Every company rely on their customers. In this competitive world you need customers to survive the world.

A screen shot of a console.

The second step to delivering extraordinary service is making sure that your support team can work comfortably with multiple channels simultaneously. The last thing you want to do is burn out your support agents with a complicated app—frustrated support agents don’t provide first-rate service. That’s why Service Cloud integrates multiple channels into an easy to use help desk called the console, which you can customize to fit your company’s unique support processes.

Organizational Alignment (V2MOM)

The Importance of Company-Wide Alignment

As the legend goes, they scribbled out the very first V2MOM on the back of an American Express envelope

Getting everyone in your organization in sync is not easy. Whether you’re a small business or a global company, it’s a challenge to get everyone moving in the right direction.

Vision Defines what you want to do or achieve.
Values Principles and beliefs that help you pursue the vision.
Methods Actions and steps to take to get the job done.
Obstacles The challenges, problems, issues you have to overcome to achieve the vision.
Measures Measurable results you aim to achieve.

Today the V2MOM is still at the forefront of how we run our business. Every year, we work collaboratively to create a V2MOM that serves as the foundation for how we align and prioritize what we’re going to accomplish. And we hold ourselves accountable for delivering results. The V2MOM has always been our “secret sauce” that’s enabled our success from the beginning.

V2MOM is an iterative, transparent, and feedback-driven process. Everyone has a chance to provide input and feedback which creates buy-in, alignment, transparency, and unity across the organization. The best part? Every employee creates one!

After the corporate V2MOM is established, it gets cascaded down to functions, teams, and individuals so everyone can create their own V2MOM. This ensures that every employee has a clear understanding of our priorities every year, and how their role, goals, and performance contributes to our overall success—now, that’s alignment.

Custom Metadata Types

Using Custom Metadata Types

Custom metadata types are very, well, meta. So before we dive in any deeper, let’s take a look at some concrete examples of what you can do with custom metadata types.

Custom settings only migrate definitions, not records.

  • Mappings—You can use custom metadata types to create associations between different objects. For example, you can create a custom metadata type that assigns cities, states, or provinces to particular regions in a country.
  • Business rules—Salesforce has lots of ways to define business rules. One way is to combine configuration records with custom functionality. For example, you can use custom metadata types along with some Apex code to route payments to the correct endpoint.
  • Master data—Say that your org uses a standard accounting app. You can create a custom metadata type that defines custom charges, like duties and VAT rates. If you include this type as part of an extension package, subscriber orgs can reference this master data.

ISV Business Planning

Narrow market from total addressable to available to target

To begin to build your business foundation:

  1. Identify your total addressable market.
  2. Perform a competitive analysis to identify your available market within your total addressable market.
  3. Using your competitive analysis, your customers’ pain points, and your business cycle, find your target audience.
  4. Further refine or broaden your customer segment to meet your business needs.

Then you create a customer profile to guide your entire team.

Lifecycle showing plan, build, distribute, market, sell, and support

Remember, the goal is to focus your energy and resources to give you a foundation in the market. You use the work we’ve done here when you create a business plan and a go-to-market strategy.

A Culture of Feedback

Open Honest Courageous

Imagine that you’ve just finished a delicious lunch and you’re energized and ready for the second half of the day. Little do you know, however, that there’s a big blob of food stuck in your front teeth.

Now ask yourself this: Would you rather know about that food stuck in your teeth, or would you rather go through your afternoon meetings only to discover it later?

No one ever got better at anything without receiving feedback

How about if the situation was reversed and it was your co-worker with food stuck in their teeth? Would you have the courage to tell your co-worker, or are you afraid of making that other person uncomfortable or embarrassed? Sure, it can be an awkward message to deliver, but chances are that if you’d want to know about it, they’d probably want to know about it too.

So, what does food stuck in your teeth have to do with feedback? Well, imagine that food stuck in your teeth was actually a small little “flaw” in your work that others can see, but you’re oblivious to. And that small thing, if done differently, would make a big difference in the impact of your work? Chances are, you’d probably want to know about it.