Tuesday, 16 May 2017

Salesforce Apex Hours:- HyperBatch

Farmington Hill Salesforce Developer group / Salesforce Apex Hours organized another successful Online session/event on Saturday, MAY 13, 2017 , focusing on "Hyper Batch".

First of All I would like to thank to "Daniel Peter" for great session and demo on "Hyper Batch". And Thank you much to all Farmington Hill Salesforce Developer Group Member for joining us online. This time more then 120+ person  joined us.

Agenda :-  
• Whats is HyperBatch
• Difference between Old Traditional Apex Batch job and HyperBatch
• Demo
• FAQ 

Speaker :- Daniel Peter (Salesforce MVP)
Date :-
Saturday, MAY 13, 2017 11:00 AM EST
Venue/Link :- Online



Session Recording :- https://www.youtube.com/watch?v=hja4o-Oa4zo&feature=youtu.be

Please follow us on below pages/link for future session :-

Amit Chaudhary

Tuesday, 9 May 2017

VLOOKUP Example | VLOOKUP Function in Salesforce | Validation Rule with Vlookup in Salesforce

In this example we will checks that a billing postal code is valid by looking up the value in a custom object called ZipCode__c that contains a record for every valid zip code. If the zip code is not found in the ZipCode__c object or the billing state does not match the corresponding State__c in the ZipCode__c object, an error will display.

Syntax :- VLOOKUP(field_to_return, field_on_lookup_object, lookup_value)

field_to_return :- the field that contains the value you want returned
field_on_lookup_object :- the field on the related object that contains the value you want to match
lookup_value :- with the value you want to match

VLOOKUP Example in Salesforce Step by Step process

Step 1) Create one custom object ZIPCODE

Step 2) Upload some Test data.

Step 3) Create Validation Rule

       $ObjectType.ZipCode__c.Fields.State__c ,
       $ObjectType.ZipCode__c.Fields.Name ,
) != BillingState

Please check below post for more detail
1) https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=0&language=en_US

Amit Chaudhary

Monday, 8 May 2017

Success Story of :- Adam Olshansky

Welcome to my 10th Salesforce Success Story series. This series is focused on success story and to inspire/encourage new user/Developer. And why we should join our local Salesforce Developer/User group.

1) Your Job Title
[ADAM ] :- Salesforce Developer

2) Your success Story
[ADAM ] :- I started off as an analyst for SAP Infrastructure and lucked into using Salesforce after a promotion. Having come from a Java background in college, I found the platform both easy to pick up and extremely user friendly compared to SAP. I also loved being able to focus on building and creating apps and not having to worry about the behind the scenes hardware. I attended my first Dreamforce and fell in love with the platform after attending a couple of hands-on trainings and experiencing the feeling of given back! I was also inspired to start getting Salesforce Certified to motivate myself to learn and prove myself on the platform to companies. After receiving 5 certs in 6 weeks, I set on the Advanced Developer path and after landing my first Salesforce developer job and achieving that cert, I started down the Architect path! Today I have 13 Salesforce certifications, am a Salesforce MVP, am a full-time Salesforce developer, and looking to give back to the community any way that I can. More info here:  https://www.adminhero.com/origins-the-story-of-adam-olshansky/ and https://www.salesforce.com/blog/2017/02/12-salesforce-certifications-relaunch-career.html

3) Why we Should Join a Salesforce User/Developer Group
[ADAM ] :- It's a great opportunity to network with other people passionate about the platform as well as learn how to use the platform in a new way!

4) Advice for new Salesforce Developer
[ADAM ] :- Don't be intimidated! There are a tremendous amount of people in the community who want to help you! There are also a great number of resources out there to help you grow your career.

5) Trailhead badges
[ADAM ] :- I have 200+ but my favorites are:

Follow Adam Olshansky on:

If you want to share your Salesforce Success Story, Please feel free to drop me an email :- amit.salesforce21@gmail.com 


Amit Chaudhary

Monday, 1 May 2017

How to create Visualforce Email Templates (Step by Step)

Visualforce Email Templates

We can also use Visualforce to create email templates. The advantage of using Visualforce over standard HTML email templates is that Visualforce offers you the power to perform advanced operations on data that's sent to a recipient

  • Visualforce email template should be within a single <messaging:emailTemplate> tag.
  • The <messaging:emailTemplate> tag should contain either a single <messaging:htmlEmailBody> or <messaging:plainTextEmailBody> tag.
  • Some standard Visualforce components are not available for use within <messaging:emailTemplate>. For Example <apex:detail>, <apex:pageBlock> and all related pageBlock components, and all input components such as <apex:form>.
  • All <apex:component> tags used within a Visualforce email template should have an access level of global.
  • The max size of a Visualforce email template is 1MB.
  • You can’t send a mass email using a Visualforce email template.


1) The <messaging:htmlEmailBody> component can include a mix of Visualforce markup and HTML.
2)The <messaging:plainTextEmailBody> component can only include Visualforce markup and plain text

Step by Step process:-

Step 1:-  Click on Email Template from start menu.

Step 2 :-  Then click on new "New Template" button and select "VisualForce" radio button

Step 3 :- Then Enter all below detail for email template

Step 4 :-  Then click on your "Edit Template" button to edit VF page.

Visual force Email Template code :- 
subject="Case report for Account: {!relatedTo.name}" 

    <messaging:htmlEmailBody >
            <p>Dear {!recipient.name},</p>
            <table border="0" >
                    <th>Case Number</th><th>Origin</th>
                    <th>Creator Email</th><th>Status</th>
                <apex:repeat var="cx" value="{!relatedTo.Cases}">
                    <td><a href = 


In Above example First we created the top level element <messaging:emailTemplate>. Using attributes we declare two different VF standardControllers used by this email template. First, the recipientType also called the WhoID and 2nd the relatedToType also refered to as the whatID in regular email template. We can also set a replyTo address, so that anyone replying to the email can reply back to this address

Using Custom Controllers within Visualforce Email Templates

Visualforce email templates can leverage custom controllers to render highly customized content. To do so, include a custom component in a Visualforce email template that uses that custom controller

<messaging:emailTemplate subject="Apex Code" recipientType="Contact" relatedToType="Opportunity">

NOTE:- Sharing settings are applied if your email templates use a standard controller. If your organization-wide default (OWD) for the user object is Private and you need to access user information in your Visualforce email template, you can use a custom component or custom controller with the without sharing keywords

Amit Chaudhary

Friday, 21 April 2017

Http Callout from Java Script | Rest Callout from Visual Force Page without Apex Class

Sample Code 1:- 

    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="  crossorigin="anonymous"></script>
        function Callout()
            var JSONResponse = '';
            var JsonBody = '';
            JsonBody = '{Request Body}';
            console.log('--JsonBody ------->'+JsonBody );
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "END_POINT_URL", true);
            <!-- xhr.setRequestHeader("Authorization","Bearer {!AccessToken}" ); -->
            xhr.setRequestHeader("Content-type", "application/json;charset=UTF-8");
            xhr.setRequestHeader("Accept", "application/json");
            xhr.onload = function () 
                JSONResponse = xhr.responseText;
                console.log('--JSONResponse ------->'+xhr.responseText);
            setTimeout( function()
                    if(xhr.status == 404){                     
                    else if(xhr.status == 401){
                    else if(xhr.status == 500){
                    else if(xhr.status == 200)
                        obj1 = JSON.parse(JSONResponse );
                        for(var x=0;x< obj1.length;x++)
                            var singleEle = obj1[x];
                            console.log('--singleEle ------->'+singleEle );
             <apex:pageBlockButtons location="Top">
                <button type="button" onclick="Callout();" style="height:22px; width:150px" > 
     Make Callout 

Sample Code 2:-

<html ng-app="demo">
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
  angular.module('demo', [])
  .controller('Hello', function($scope, $http) 
   var req = {
     method: 'GET',
     url: 'END_POINT_URL',
     headers: {
       'Content-Type': 'application/json',
       'authorization':'Bearer TOKEN_VALUE'
     body:{'test body'}

   $http(req).then(function(response) {
      $scope.greeting = response.data;

  <div ng-controller="Hello">
   <p>Content is {{greeting}}</p>

You May get below error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at END_POINT_URL. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Solution :- To resolve the issue you need to request external system to add Salesforce Base URL in CORS


Amit Chaudhary

Sunday, 16 April 2017

Success Story of :- Fabrice Cathala

Welcome to my 9th Salesforce Success Story series. This series is focused on success story and to inspire/encourage new user/Developer. And why we should join our local Salesforce Developer/User group.

1) Your Job Title
Senior Salesforce Solution Architect

2) Your success Story    
I started my career in the world of data centres in 1994 and took the risk to change my path to CRM implementations in 2001. In 2005, I discovered cloud computing when deploying Salesforce at Symantec. Only then I realised that my career change had paid off.
I moved from a highly technical job (working at the operating system level) to a mix of technology and business (CRM). Salesforce fulfils the geek in me as much as giving me the satisfaction of delivering business solutions to happy customers. I could have stayed monitoring networks and controlling IT systems performance forever, but I follow my gut feeling, stick with it for five years before getting rewarded.
In March 2017 I was honoured to be awarded the title of Salesforce MVP joining a crowd of highly talented individuals.

Build your career path, believe in yourself and keep learning.   

3) Why we Should Join a Salesforce User/Developer Group

User groups are a great way to learn new Salesforce related topics that you may not need for your current project but will position you as "the expert" in your next project.
The ambience in the Salesforce #ohana events is always warm and welcoming. Networking becomes fun! After a little while,  attending a Salesforce meetup will turn into an excellent way to meet your friends from the ecosystem, chill-out still learns new Salesforce tricks.
I'm a co-organizer of the Thames Valley DUG in the UK, and I can tell you that we do spend quite a lot of time and energy hunting for the best speakers and researching which hot topics we should propose to our audience. 

Now, there's one user group in particular that I'd like to put under the spotlight and it's "Women In Tech" (#WIT). In most cases, these groups are welcoming men, and I'm begging you, if you're a man, please attend at least a couple of WIT meetup this year. It's going to open your mind to an old problem which now needs an urgent solution. I believe that men need to be part of the solution to unlocking STEM careers for women. Please attend WIT meetup and show your support for a start. Then try and figure out how you can help.

4) Advice for new Salesforce Developer

If the only tool you have is a hammer, it is tempting to treat everything as a nail. But you shouldn't. Although it's fun to code, your responsibility is to provide an enterprise-class solution to all business problems thrown at you. The most robust tool is not code but standard (declarative) features: they have been tested for years and are supported by Salesforce. Your code will always be less resilient than out-of-the-box capabilities.

For this reason, always think declarative first and programmatic second.  

5) Trailhead badges
105. I'm a ranger since last December; the #100club was one of my goals for 2016. I've slowed down since (only five badges in three months) but will restart soon at a more steady pace.
Follow Fabrice Cathala on:
Twitter :

If you want to share your Salesforce Success Story, Please feel free to drop me an email :- amit.salesforce21@gmail.com 


Amit Chaudhary

Sunday, 9 April 2017

Salesforce Apex Hours:- Lightning Component Framework

Farmington Hill Salesforce Developer group / Salesforce Apex Hours organized another successful Online session/event on 8th April 2017, focusing on "Lightning Component Framework".

First of All I would like to thank to "Mohith Shrivastava" for great session and demo on "Lightning Component Framework".

Agenda :-
  • Introduction To Lightning Components
  • Difference between Lightning Components and Visualforce
  • Thinking in terms of Component Model
  • Basics of Lightning - Inside Bundle
  • Events - Discuss Application and Component Events

Speaker :- Mohith Shrivastava, Salesforce MVP.
Date :- Saturday, April 8, 2017 11:00 AM EST
Venue/Link :- Online on Goto meeting



Some Useful link for "Lightning Component Framework" 

Code Reference 

Please follow us on below pages/link for future session :-

Amit Chaudhary