Considerations and Best practices for Salesforce Dataloading

Although we are doing data loading in Salesforce from ages, its very common to miss some steps or considerations. Therefore thought to list some of best practices and considerations I follow before or during data load process.

Salesforce Dataloader
Salesforce Data loader Considerations

Continue reading “Considerations and Best practices for Salesforce Dataloading”

Trailhead Widget for your Website

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags with Leave a comment on Trailhead Widget for your Website

Show your hard earned badges by adding Trailhead Widget on your Website or Blog

Here it comes, Christmas goodies for Trailhead lovers. If you own WordPress, blogspot or any website, use this Trailhead widget to show and brag about all your badges. Badges,  which you have earned by completing challenges on sleepless nights, on airport, during commute or over the weekends. What could be the best way to show Trailhead profile summary other than widget?

Will it impact performance of my website

All computations are done outside of your website and Javascript execution is asynchronous, which will make sure website rendering is not blocked by this widget.

How to use it

Step 1

Identify the URL of your Trailhead profile. Make sure you are not copying URL of success community. Below image shows steps to get Trailhead URL. We just need end part of URL, after last forward slash. Continue reading “Trailhead Widget for your Website”

A Tale of Governor Limits and Solutions in Salesforce

Thrilling story of Salesforce Technical Architect on a quest to solve application problems and avoid governor limit errors

This is a work of fiction. Names, characters, businesses, places, events and incidents are either the products of the author’s imagination or used in a fictitious manner. Any resemblance to actual persons, living or dead, or actual events is purely coincidental.

Ha ha ha joking.. its combination of many real stories of my previous projects and few readers might be from my team itself 😉 . Leave comment my brave team mates if you are able to co-relate !!!

I tried to summaries as much as possibilities about governor limit errors and way to get out of it. Most of scenario described below may not be the first choice of Technical Architects however because of many reasons like budget, resource skill, tools available and compliance, bad decision could be taken which causes ripple effect on Salesforce scalibility.

Before start, I would encourage readers to leave comment on post and let everyone know in this suspenseful story, did you catch governor limits and Solution already before its exposed ? In this blog post, answers are mostly in invisible/white font which would not be seen until you highlight it. Its for few readers who don’t want spoilers. 

Let’s start a story. Continue reading “A Tale of Governor Limits and Solutions in Salesforce”

Import and Export Records using Salesforce DX

Using Salesforce DX to Export and Import records into regular Salesforce Instances without dependency on developer hub org

In today’s continuous integration solution built for Salesforce, if you need to load sample data into Salesforce then either we use command line dataloader or custom tool built to import export records.

With Salesforce DX, we can import and export records right from Salesforce DX. Again, if you are new to Salesforce DX, then first read this blog post to quickly understand what is Salesforce DX. 

We don’t need Developer Hub or Scratch Orgs to use Salesforce DX for import and export. In this blog post, I have used my regular developer org for demo.

First step as always, to make sure if Salesforce DX CLI is connected to your Org or not ? If its not connected then use below command to connect and give alias which is easy to remember. Continue reading “Import and Export Records using Salesforce DX”

Use Metadata API with Salesforce DX

How to use SalesforceDX to deploy metadata in Sandboxes or Non-Scratch Salesforce instances

If you have existing VCS which stores metadata information about your Salesforce instance in old format, dependent on package.xml and you want to use Salesforce DX then this blog post is for you. As you might already know, Salesforce DX does not need package.xml and can automatically detect changes in your Salesforce instance, therefore new Salesforce DX project format is different. In this blog post we will see, how Salesforce DX can be used without enabling Developer Hub and using Salesforce DX with normal Salesforce instances.

There are two solution to this problem

  1. Keep using old Project format and use Metadata API to retrieve and deploy
  2. Convert old project format to Salesforce DX project Format

Continue reading “Use Metadata API with Salesforce DX”

Continuous Integration vs. Continuous Delivery vs. Continuous Deployment

Difference between Continuous Integration vs. Continuous Delivery vs. Continuous Deployment

I have written many posts about Continuous Integrations and implemented many projects with capability of Continuous Delivery. However multiple times got into discussion on what exactly is difference between Continuous Integration, Continuous Delivery and Continuous Deployment. As SFDX is new way to develop and deploy changes in Salesforce, just thought to post a small post on basic difference between these terms.

Continuous Integration

Continuous Integration is automated build scripts to detect changes in Source Code Management (SCM) like Git. Once the change is detected, source code would be deployed to common dedicated build server (Sandbox) to make sure build is not failing and all test classes and integration tests are running fine. Continue reading “Continuous Integration vs. Continuous Delivery vs. Continuous Deployment”

Create Breadcrumb Or Chevron Control in Salesforce Flow

Display chevron control or breadcrumb in Flow to show Salesforce flow screen navigation progress

Have your end user complained or wanted some more coolness from Flow ? Do they want to have a nice clickable graphical presentation at top of page showing their progress or page number ? Recently, I was having a discussion with my colleague on same requirement. User should be able to jump between pages and at the same time, pictorial status should be displayed. Can we do it in Flow ? Can we create a chevron control or breadcrumbs in Salesforce Flow. Answer is yes.

Winter 18 has lots of cool functionalities for flow and we should not be left behind in adopting flow as part of our solution, at last, its point and click instead of code.

I will take help of my previous article, which explains how images can be used in formula field from static resources. In our case, instead of formula, we will use Display Text component in Flow. For this post, you can upload this zip file as a static resource and use in FlowThis zip file contains total 6 images for three pages, active and inactive images. Continue reading “Create Breadcrumb Or Chevron Control in Salesforce Flow”

Using JWT Flow to Authenticate Nodejs application with Salesforce

Video tutorial and Complete source code to use Salesforce JWT OAuth to authenticate Nodejs Application

JWT OAuth uses digital signature to authenticate external application with Salesforce. JWT can be used to request an OAuth access token from Salesforce when a client wants to use a previous authorization.

Complete Source code is available here.

How JWT OAuth works
  1. Developer creates a connected app and provides digital certificate in OAuth settings. You can refer this post to understand how openssl can be used to create digital certificate locally.
  2. We need to make sure this connected app is already pre – approved either by using WebServer, User Agent or any other flow. You can find this step in video recorded.
  3. We need to generate JWT token and sign it with certificate. This code snippet is available in this file in method getJWTSignedToken_nJWTLib(). I have used njwt module of Nodejs to create a JWT token. This is very useful website to validate and generate JWT token as per digital certificate.
  4. Next we need to send JWT request to token URL –  https://login.salesforce.com/services/oauth2/token
  5. If JWT request is valid then Salesforce returns access_token , which can be used in subsequent requests to perform allowed operations in Salesforce via Nodejs application.

Continue reading “Using JWT Flow to Authenticate Nodejs application with Salesforce”

Salesforce Winter 18 Release – My Favorite Features

My favorite Salesforce Winter 18 features about Lightning, Flow, Platform Event , Shield and Salesforce DX

There are many cool features features in Winter 18, however I would be listing only my favorite top picks from 589 pages of release notes. Would suggest to through this post to understand Sandbox readiness dates for Winter 18.

You can check materials of this meetup as well organized by Amit, where I shared my favorite Winter 18 feature with sample code.

  1. New Lightning Base Components

Lightning Base components are out of the box component created with Salesforce Lightning Design System CSS. If there are no Lightning Base components, You would need to use aura or HTML components and write custom CSS to make look and feel similar to Lightning Experience. Base component starts with lightning: namespace. There are many new Base components introduced like lightning:datatable ,  lightning:checkboxGroup , lightning:dualListbox ,  lightning:progressIndicator , lightning:progressBar,  lightning:slider. Recently only I blogged about Read only Chevron Component with mountains of code. Even though we are using this component for last 6 months however If my project could have waited, then all I had to use is 5-6 lines of code using lightning:progressIndicator.

2. Component Library (Beta)

We can already see all standard and custom component information using https://<myDomain>.lightning.force.com/auradocs URL. However, as part of Winter 18 release, Salesforce came up with revamped website just like Lightning Design System to show code snippets on how to use Lightning Components. You can navigate to Component Library using https://<myDomain>.lightning.force.com/componentReference/suite.app URL.

3. Lightning Data Services (GA)

We are hearing about Lightning Data Services from almost last one year and finally its generally available for use. You can check this blog post on how to use it. Continue reading “Salesforce Winter 18 Release – My Favorite Features”

Enterprise Territory Management – Auto Account Assignment using Apex

Use Apex code to auto assign Accounts on basis of Enterprise Territory Assignment rules

Using Territory Management in Salesforce, we can auto assign territories to Account and give access to users working in common region. When we create Account, Territory Assignment rules automatically runs. On Account update we have a checkbox on page layout allowing to run Territory rules. However, Lightning experience does not support Territory Assignment checkbox yet on page layouts.

Unfortunately, Apex also does not support Account Assignment using Territory rules. Only way left is to use Salesforce API. Question is, just to run Enterprise Territory Management rules, should we import WSDL and convert it to respective Apex classes ? There must be some better way.

Then I remembered this article which I wrote around 5 years back. Instead of importing WSDL into Salesforce and converting it to Apex classes, we can take help of SOAP UI to find the request format and using HttpRequest, we can simulate request. Continue reading “Enterprise Territory Management – Auto Account Assignment using Apex”