Another Powerful Trailhead module - Event Monitoring

Salesforce introduces Trailhead – a fun way to learn Salesforce. It doesn’t matter whether you are Salesforce Admin or Salesforce developer, there are bunch of modules available for your based on your career path. The more modules you complete, you will get more badges and those badges will be attached to your profile. So you can see yourself going stronger and stronger day by day. That is the primary goal of using Salesforce Trailhead – Make yourselves a better Salesforce Admin or a better Salesforce Developer.

To achieve your goal, Salesforce Trailhead team recently introduces three new admin modules –
Out of these above three modules, the module which really looks very interesting to me is the Event Monitoring module. I immediately jumped into it and completed the same. Once completed, I have realized the power of event monitoring. Monitoring event is so important to a Salesforce Admin. In my daily day to day to work, I normally receive so many requests which now I can answer quickly with the help of event monitoring.

Let me tell you what makes this module so interesting.

This module consists of three sub modules as shown below –

The first sub-module - Get Started with Event Monitoring –
This sub-module explains the basic like what is event monitoring, what are different types of events present, use cases where event monitoring should be used. But the key part of this sub-module is: the API first approach. This event monitoring is an API only feature. You will not get this feature inside setup area. It explains in which object event logs are stored and how you can retrieve the same.

Like any other modules in Trailhead, this module is also having an area – which I normally call – “Judge yourself”. You have to answer few multiple choice questions and if successful you will get 100 points.

Once I have completed this sub-module and earned my 100 points, it inspired me even more to go to the next sub-module Query Event Log Files

The second sub-module - Query Event Log Files –
This module is one for which I was waiting – how to query event log files. This module will explain what is API first approach. This module also explains how we can query an EventLogFile object using SOQL and REST explorer. Another important part of this sub-module is that it compares SOAP and REST APIs for querying event log files.

This sub-module also comes with multiple choice questions, but the questions are getting harder here. So you need to read the questions and answers very carefully to choose the right answer. At the end of this, you be awarded with 100 points.

The final sub-module - Download and Visualize Event Log Files   -
This module is having many information, so completing this module is not possible in 15 mins. At least it took 45 mins for me to complete this sub-module. This module describes the structure of the downloaded event log files, how to read the downloaded file. As downloaded event log file can have many information which may be you are not interested, so this sub-module will explain how to extract only the important information from downloaded log file. This sub-module comes with multiple choice questions (mainly programmatic questions) and same like other sub-modules, here also you will be awarded 100 point upon completion.

Finally – I received the badge on my profile. I would request all to complete this module and make yourself a better admin/developer. 


Book Review - “Salesforce Reporting and Dashboards” by Johan Yu

Recently I was reading the book – “Salesforce Reporting and Dashboards” by Johan Yu. 

Johan is a very familiar face within Salesforce community.
You can always reach Johan @simplysfdc, Linkedin and last but not the least his blog SimpleSFDC. I am a big fan of his blog.

The book - “Salesforce Reporting and Dashboards” contains a good selection of guides for solving reporting requirements. It started very well, I mean starting from very basic and then slowly moving towards more and more complex reporting requirements. When I started reading this book, I thought what makes this book different from Salesforce’s Trailhead session on reporting - Reports & Dashboards. And here is what I feel. When Trailhead session is good to make you comfortable with Salesforce’s Reporting concept, but still there are so many complex scenarios which you need to handle in your day to day work. And this book is definitely an answer to those complex scenarios. This book will make sure that you can call yourself a “Reporting and Dashboard Expert” once you have gone through the entire book. Yes you hear it correctly – It’s “Reporting and Dashboard Expert”.

I have experienced some difficulties during my career as Salesforce Administrator/Developer to provide solutions to some of my client’s reporting requirements. So when I was going through this book, I realized this book contains some effective remedies to many common problems. The solutions are provided in a very straightforward way – no unnecessary waffle – just straight to the point and explaining step by step how to implement the solution.

I personally love few sections from this book. Like
  • Hands-on – subscribing to a report – This really explains how to subscribe to a report and see the subscription in Salesforce1. Integration Salesforce1 in the hands-on is really a plus point to me.
  • Chapter 5 – Learning Advanced Report Configuration – This chapter is the jewel. Many important  configurations like bucket field, formula field, Grouping, Scheduling report etc. are explained here in a very simple way. To me this chapter is the one I need to refer again and again.
  • Chapter 8 - Accessing Historical Data – This is also a very important chapter. Accessing historical data over report is a very common requirements, but to implement the solution, one should have a very clear understanding on how it should be done, what can be done and what cannot be done. This chapter is a one stop shop for all these answers.
  • And finally Chapter 9 – Dashboard and Reports in Salesforce1 – Believe me this chapter is the differentiator. This chapter explains the concept and most important the limitations of Salesforce1 app. Understanding limitation is very important in the context of Salesforce and it will make the design more concrete.
In summary, if you are a Salesforce Admin looking to explore some of the advances concepts of Salesforce Reporting and Dashboard, then “Salesforce Reporting and Dashboards” is a must have. I am now encouraging all of my admin colleagues to read this book and challenge their solutions – because I believe by challenging ourselves, our best will come out.

You can buy this book from Amazon, PACKTPUB.



In continuation with my previous two posts -
today, I will explain how you can fetch geographic data from Salesforce and accordingly show them in Salesforce.

To start with let me first create an object - Household where I can store geographic information. Below you can find the object details - 
Now the Visualforce page - Mapbox Click here

Now when you will open the page you will see the three locations plotted.

In this example, I am using apex:repeat to prepare the GeoJSON data. To understand what is GeoJSON data, below is what Wikipedia stating -

Once the GeoJSON data is ready, I am adding the same with featurelayer -


Finally, I am using the click event to show the Household name when user clicks on the points inside map. The code for that - 

//Show popup with information on mouse click

In my next post, I will explain how you can draw geographic areas inside map using Mapbox. Please provide your feedback. Thanks.


In continuation to my previous post - INTEGRATE MAPBOX WITH VISUALFORCE TO CREATE BEAUTIFUL MAP - Part I, today, I will play with few attributes from Mapbox to make the map more interactive.

Below are the things I will do -
  • I will add different layers and explain how to toggle between layers.
  • I will add scale control
  • I will add attribution control
  • I will set the location in the map
To understand what is layer and how Mapbox works, I would request you to go through the official Mapbox tutorial @ https://www.mapbox.com/guides/how-mapbox-works/. Since from this post, we will go into deep with Mapbox, so it is better to have your basic clear in terms of how Mapbox works and what are the terminologies they use.

Let's go directly to the Visualforce Page Mapbox_2 click here

Now if you open the Visualforce page, you will see - 
Clicking on Layer icon, you will see -
Choosing Sudipta First Map, you will see different map like -

Cool!!. There are many more attributes available which you can check from Mapbox Developer resource @ https://www.mapbox.com/mapbox.js/api/v2.2.1/

In my next post, I will explain how you can retrieve geographical data from Salesforce object and show them in map with Mapbox API. Sounds interesting, right!! I am working on this now, very soon I will share the information with you all.

Till then, if you have any feedback, please share with me. Thanks.


Maps are very powerful application to visualise information. In today's world, map plays a very important role as many customers want to integrate maps with their applications to represent their account, contact, lead and many more information visually through map.

In one of my recent project, I came across a similar requirement where I need to integrate map with Visualforce to show lead information visually in map. To implement this requirement, I have chosen Mapbox. I know you have the question in mind - Why Mapbox, why not Google Map? The reason why I have chosen Mapbox, not the Google Map - I will come to it later. But for the time being let's keep our focus completely on Mapbox.

In this post, I will explain how you can integrate Mapbox with Visualforce page. I will start with a very basic example and then dig into more and more complex ones. I believe in this way, you will also feel more comfortable with Mapbox+Visualforce integration.

Note - The day I am writing this post, the version of Mapbox API is: Version 2.2.1.

Step 1 - Create Mapbox account
First you need to create a Mapbox account. You can do that by clicking on Signup button.

Step 2 - Get Default Public Token 
Once you have logged in, go to your profile, followed by click on Apps to get your default public token. Below is the screenshot -

Step 3 - Create your first project
You can create your first project by clicking on the project icon at the top. Once the project is created you will get the project id.

With the above three steps, our Mapbox configuration is completed. Let's move into our first basic example -

Example - Display Mapbox With Visualforce Page -

Below is the Mapbox_1 Visualforce page. Click here

Now when you will open this page, you will see the map like below -

In my next post, I will play with few attributes to make the map more interactive. Till then, if you have any feedback or specific requirement, I will really appreciate if you can post it to me. Thanks.



This post is part of the series - Design Pattern in Apex

I know it was discussed number of times earlier about Apex Trigger Design Pattern. Below are few excellent posts -
I have learned a lot from the above two posts by Steve Andersen and Mike Leach.
But the post by Abhinav Gupta really inspires me a lot and I am going to explain the pattern/template here with few use cases.

The motivations for this design pattern are -
  • Write Trigger with minimum code
  • Follow Salesforce Best Practice - One Trigger per object
  • Follow another Salesforce Best Practice - Move all code from Trigger to Apex Classes - Handler Classes
  • Ability to add and order multiple handlers for the same trigger event.
  • Easy to maintain code base.
Here is the Apex Trigger template - MyTriggers (Again inspired by Abhinav Gupta)
Now using the above template, below is the account trigger handler - AccountTriggerHandler

And finally the trigger - AccountTrigger

Now the trigger code is very neat and clean. At the same time all our operations against trigger events are moved to handler class.

So now let's consider few use cases -
Use Case 1 -
While inserting new accounts, if the Account Rating is marked as 'Hot', then mark those accounts as Active and make the Customer Priority as 'Medium'.
Implementation -
To implement the above requirement, what we need to do is simply add the functionality in AccountTriggerHandler.AccountBeforeInsertHandler class. No changes in Apex trigger code is required.
Here is the updated AccountTriggerHandler

Use Case 2 -
While updating accounts, if Account Name changed, find how many account name changed and print the count.
Implementation -
To implement the above requirement, what we need to do is simply add the functionality in AccountTriggerHandler.AccountBeforeUpdateHandler class. You can do the same in AfterUpdate also. :-)
Here is the updated AccountTriggerHandler

Please provide your feedback. Thanks.


Let me discuss about another use case where it is required to pass information from one VisualForce page to another VisualForce page while both the VisualForce pages are sharing the same controller. I know this is a very basic example, but I would like to include this use case as part of my previous post - HOW TO PASS PARAMETERS TO VISUALFORCE PAGES AND BETWEEN PAGES. Special thanks to Joseph McNulty for pointing this to me.

To start with let us first create the common controller – SingleController

Here is the first VisualForce Page – FirstPage.

Here is the second VisualForce Page – SecondPage.

As you can see from FirstPage, I am setting the name to the controller variable - name and then clicking on the commandButton,  goToSecondPage() method from controller is getting called. This goToSecondPage() method is returning a PageReference to the SecondPage. The point to notice here is that inside the method goToSecondPage(), I am making the setRedirect(false). I will explain what will happen if I set it to true later in this post. So what is happening after clicking on the button is that a SecondPage is getting displayed with Welcome message. But another interesting thing to notice here is that URL is not getting changed i.e. URL is still pointing to /apex/FirstPage though the content is from SecondPage.

So before going further inside, I hope you now know how you can pass information from one VisualForce page to another where both the pages are having common controller.

Now the interesting part –
With setRedirect(false) – redirect is happening through a server side redirect and the URL is not getting changed. In our case, since the target page is using the same controller that is why the view state is preserved. As a result, in the new page i.e. SecondPage; you can see the name after Welcome message.
But with setRedirect(true) - redirect is happening through a client side redirect and the URL is getting changed. View state is also not preserved and you will not see the name after Welcome message.

I am thinking of a more detailed post on setRedirect method. It may look very simple, but it is basically doing many interesting stuffs at the back stage. As a developer, we should understand this method very clearly.
If you have any feedback, please pass it to me. I really appreciate it. Thanks.



I am sure we all came to different situations where we need to pass parameters to VisualForce pages while doing Salesforce development. So I thought of putting all scenarios together in a single post with the solution approach. So without any further introduction, let's get into the actual agenda quickly.

First let me explain the basic -

A parameter is a name-value pair which is embedded at the end of the url of a page. The first parameter always starts with '?' and all the subsequent parameters start with a '&'.
Let's take the below example -

  • The first parameter is firstname=Sudipta where name is firstname and value is Sudipta
  • The second parameter is lastname=Deb where name is lastname and value is Deb
With the basic explained, let me start with different scenarios and solution approach

Sometimes it may be required that by clicking on custom button we need to open a new VisualForce page and pass parameters to that new page. For example - if we create a custom button for Account object, while configuring if we choose VisualForce page we can select only those VisualForce pages having standardController="Account" set. To overcome this, we need to choose Content Source as url while configuring Custom Button. Screenshot is given below -
Below is the VisualForce Page - showAccountName

In order to pass parameters from one VisualForce page to another one, we can use command link or command button. Let's start with an example where clicking on command link a new VisualForce Page will be displayed along with the message passed from the previous page.

First create a simple VisualForce Page - FirstPage

As you can see in this page, I have used a command link which is passing a parameter with key value pair as firstName=Sudipta to a new Page - SecondPage

So now create the second VisualForce Page - SecondPage

As you can see that SecondPage needs a controller - SecondPageController. This controller will capture the parameter passed to it and set it to a variable.
Here comes the controller - SecondPageController

In this controller, the below line is important which is used to capture the message passed from FirstPage -
firstName = System.currentPageReference().getParameters().get('firstName');

With this approach, we need to keep in mind few things -

  1. All the parameters we are passing this way will be displayed in the page url. So if you are thinking of passing some confidential information, better not to do that. Otherwise you confidential stuffs will become public properties. :-(
  2. If you want to pass something having special character like accountName as "Batman & Superman", it will create problem. So it is always better to pass Salesforce ID or something unique identification field.
Please pass your comments. Thanks.

Follow Me

Enter your email address:

Delivered by FeedBurner

Popular Posts


Salesforce (105) Apex (46) admin (27) visualforce (21) ADM (20) dev 501 (19) integration (18) learn salesforce (18) 501 (16) SOAP (13) lightning (13) tutorial (11) Certification. (10) javascript (10) Kitchener Developer Group (8) Certification (7) Trigger (7) test class (7) unit testing (7) Advanced Admin (6) Sharing and Visibility (6) design pattern (6) developer (6) report (6) salesforce release (6) security (6) service cloud (6) trailhead (6) Advanced Apex (5) New Features (5) SOQL (5) css (5) dashboard (5) debug (5) formula (5) mobile (5) solution management (5) use case (5) JSON (4) Kitchener User Group (4) Lightning Experience (4) Salesforce DX (4) Tips (4) WebSphere (4) best practice (4) cast iron (4) component (4) deployment (4) event (4) github (4) html (4) polymer (4) profiles (4) responsive (4) tdd (4) ui (4) Architect (3) Lightning Web Component (3) Live Chat (3) Online Event (3) Opportunity (3) Performance (3) Products (3) REST (3) Role (3) Sales Cloud (3) Scratch Org (3) Study Notes. (3) Summer15 (3) Web Technology (3) automation tool (3) dynamic apex (3) license (3) map (3) mapbox (3) singleton (3) version controlling (3) Asynchronous callout (2) Bulkify (2) Community (2) Data Architecture and Management Certification (2) Devops (2) Distributed Version Controlling (2) ES6 (2) Eclipse (2) Einstein (2) Enterprise Territory Management (2) Financial Services Cloud (2) Force.com IDE (2) Governor Limit (2) Groups (2) IBM (2) Implicit Sharing (2) JourneyToCTA (2) Lightning Design System (2) Live Agent (2) Metadata (2) PD II (2) Price Book (2) SOSL (2) Salesforce Certification (2) Sharing (2) Spring 15 (2) Summer17 (2) Territory (2) Virtual Event (2) ant (2) basic (2) chatter (2) coding (2) communication (2) console (2) controller (2) documentation (2) dreamforce (2) flow (2) git (2) jquery (2) logging (2) object (2) permission (2) process builder (2) release (2) salesforce1 (2) strategy (2) xml (2) Action Plan (1) Action Plan Template (1) Activity Timeline (1) Advanced Currency (1) Agent Productivity (1) Analytics (1) Apex Sharing (1) AppExchange (1) Arrow (1) Article (1) Asynchronous Apex (1) Aura Framework (1) Batch (1) Bots (1) Browser (1) Bulk data load (1) CTA (1) Calendar (1) Canon (1) Case Management (1) Celebration (1) Cheat Sheet (1) Classic (1) Compare (1) Confetti (1) Constructor (1) Contact Center (1) Continuation (1) Continuous Integration (1) Convert (1) Cookie (1) CumulusCI (1) Custom Metadata (1) Custom Object (1) Customer (1) Dated Exchange Rate (1) Decorator Design Pattern (1) Dev Hub (1) Development (1) Diwali (1) EDA (1) Education Cloud (1) Email (1) FSC (1) Function (1) Future (1) Global Gathering (1) Goals (1) Guest Access (1) Guest Profile (1) Guest User Sharing Rule (1) Guide (1) HEDA (1) Higher Education (1) Household (1) Ideas (1) Improvement (1) KPIs (1) Knowledge Management (1) Large Data Volume (1) LastModifiedDate (1) Lightning Feature (1) Manage Currencies (1) Manual Sharing (1) Metrics (1) Multi Currency (1) New (1) New Feature (1) OOPS (1) OWD (1) Omni-Channel (1) Partner (1) Person Account (1) Photo (1) Pipeline (1) Platform Developer I (1) Platform Developer II (1) Presentation (1) Product Schedule (1) Profile (1) Promise (1) Prototype (1) Public Site (1) Query Plan (1) Queueable (1) QuickReference (1) Related records (1) Reports (1) Retrieve (1) Role Hierarchy (1) SAL (1) SFDX (1) Salesforce Advisor Link (1) Salesforce Labs (1) Salesforce Optimizer (1) SalesforceDx (1) Schedule (1) Session (1) Sharing Rule (1) Sharing Sets (1) Site (1) Skills (1) Snap-ins (1) Spring 17 (1) Spring 20 (1) Summer14 (1) Summer16 (1) Summer19 (1) Switch (1) SystemModStamp (1) Timeline (1) Unauthorized Access (1) User License (1) Users (1) Webservice (1) Winter'15 (1) Winter'17 (1) access (1) actionFunction (1) actionPoller (1) actionRegion (1) actionSupport (1) agile (1) app (1) approval process (1) aura (1) awesome (1) backup (1) bitbucket (1) book (1) campaign (1) change set (1) code (1) code coverage (1) configuration (1) csv (1) custom button (1) custom settings (1) customization (1) data loader (1) database (1) delegate Admin (1) describe (1) dom (1) duplicate (1) dynamic (1) equals (1) error (1) field-level security (1) folder (1) ftp (1) generic (1) gift (1) global describe (1) hashcode (1) import wizard (1) jenkins (1) keynote (1) long running requests (1) monitoring (1) mysql (1) page layout (1) personal (1) power of one (1) record type (1) relationship (1) request (1) review (1) sub-tab (1) tab (1) username (1) visual workflow (1) workflow (1)

Total Subscribers

Total Pageviews

Contact Me


Email *

Message *