Wednesday, 8 March 2017

Success Story of : Vinay Chaturvedi

Welcome to my 7th 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.

[Vinay Chaturvedi]
:- Working as a Principal Consultant with Dazeworks,

2) Your success Story. 

[Vinay Chaturvedi] :-  I am an Electrical Engineer by education but was very passionate about the Software Industry, that’s the reason why an Electrical engineer took the most critical decision once that was a life changing event for me. I take pride in saying this and saying this again "Salesforce=Successful me", today, everything I do, everything I talk, its Salesforce everywhere. I am Loving & Living Salesforce since 2011, working as a Principal Consultant and have been through every phase of career as a Consultant / Developer / Geek / Evangelist. I have been awarded as a Salesforce MVP in 2016. I am also leading Salesforce User/Developer Groups here in Noida, India. I Leads Salesforce User Group Leaders Office Hours Call for APAC Region.[#SFUGLOH]. I love contributing to Success Community and proud that he has answered more than 4.5K answers check those out here: SalesforceAnswerCommunity. I started blogging in 2014 and have worked on various awesome blog series such as Learn Salesforce Lightning with Examples, Formulas series, Reports series, AppExchange App review series, Learn Regex in Salesforce with Examples, you can check all here on my website: ( Amit :- He is hero in Noida :) )

3) Why we should join a Salesforce User / Developer Groups.

[Vinay Chaturvedi] :-     A chance to Network with the fellow Trailblazers: - Salesforce brings you this amazing opportunity to network and interact with the awesome Salesforce community around the globe and to network with the fellow trailblazers and a chance to grow together that makes up to the strongest community and Salesforce-Ohana.
    Knowledge Sharing:- Knowledge Sharing and Knowledge Exchange is the biggest advantage one gets attending the Group Meetups, that's your chance to grow and learn. One also gets helped in setting the future roadmaps looking over and listening to success stories coming from the community that inspires us to be the best. 
    Fun Activities:- If you've never been or attended the local User/Developer group Meetup/Events before, don't miss to be here Learning with fun, for me leading the group and making arrangements for every meetup is one of the things I love the most as it helps me be the best. Planning for the Events by collecting feedbacks from the members helps me to add more value and maintaining uniqueness of the Group events lead by me.
    Every member gets a chance to shine, share knowledge, to present before others, speak before large gathering and skill improvement are added on advantages and this provides everyone, a chance to get recognized by all.

4) Advice for new Salesforce Developer.

 [Vinay Chaturvedi] :- Success is something which takes efforts, its earned with time, the only way is hard work and consistency. Kick-Off with Trailhead- The fun way to learn, that brings you everything that helps you grow better and smoother. Join the Local User/Developer group and keep aligned with the awesome Salesforce Community to explore the possibilities to grow & enhance your learning. Your successful career is just a step away, followed by Success all around. Wish you all the best.

5) I am a proud Trailblazer:-

[Vinay Chaturvedi]:- Mission 150-Badges accomplished, I'm a Ranger! It's so pleasure being here every time as this is my favorite pastime, this is one stop shop for getting everything around Salesforce, something I never miss  on : are the release related badges that keeps me updated about all new functionalities added to Salesforce platform. (Amit :- wow :) )

Follow Vinay on:

If you want to share your Salesforce Success Story, Please feel free to drop me an email :-


Amit Chaudhary

Wednesday, 1 March 2017

Success Story of : Eric Dreshfield

Welcome to my 6th 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.

( Eric is one of the person who inspire me to write success story series )

1) Your Job Title: 

[Eric] Advocacy Manager @ Apttus; also Founder, Midwest Dreamin'; & Leader of the Southern Indiana Salesforce User Group

2) My Success Story:  

[Eric] Like most people in the Salesforce ecosystem, I didn't start my career there. I stumbled my way into that morphed into a business analyst helping a company implement the Service Cloud. That was my first exposure to Salesforce. My manager told me to find a user group to network and learn all I could, which set me on a 6 to 8 month journey of traveling 1 or 2 days a no 4th to attend user group meetings where ever I could find one, since my home town didn't have one. After hundreds of miles, I wondered if there were other in my town using Salesforce so I asked someone at Salesforce what it took to start a user group & her response was, "Congratulations, you just started one!" lol and behold there were others in my area using Salesforce and the group was a hit. Over time, I changed to a different local company that was getting ready to rollout the Sales Cloud and Veeva to its medical sales representatives. Then Dreamforce 2014 came and I saw a demo of X-Author for Excel by Apttus and my whole world changed. I fell in love with the tool instantly and decided that Apttus was the next place I wanted to work. It took almost 2 years to make that happen, to convince them that what I was offering would bring them value. Ultimately, Apttus created a role for me supporting X-Author for Excel from the marketing perspective. short: of you can't find a job you want, find a company you want to be a part of and work to create the need for your talents there. You can read my full success story here: (Amit:- You are supper star of salesforce community )

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

[Eric] I say this all the time in my blog posts: For me, one of the greatest strengths of the Salesforce Community is it's people and the connections that are shared...and that's why you should join your local user, developer, women in tech or other group. The Community is the lifeline and support system for Salesforce users. Its an amazing place. You never know what questions you can get answered there, or who you will meet. At my first Dreamforce I had a random meeting at the breakfast table with a co-worker of my brother-in-law. I've also met future managers of mine through the Community in more than one occasion.

4) Advice for new Salesforce Developer:

[Eric] I'm stll what most would call an aspiring developer, so I may have a different perspective than others. Salesforce Developer skills are in high demand, so as someone new to it, my advice would be this: learn all you can through things like Trailhead, Pluralsight, and other online resources. Make sure you practice in a free Developer org so your knowledge isn't just "book smarts." Try to find a nonprofit organization that needs some help with Salesforce and do are your time and skills to help move them forward. Once you have knowledge and some real world experience, go after the certifications that will help you move forward in the path you choose.

5) Trailhead badges: 

[Eric] I have a few...very few. I wish I had more time to be able to knock out more on a regular basis, but I tend to go to Trailhead when I encounter a specific need, that is, when I have a challenge to do that I know is possible, but I'm not certain how to accomplish it. Most likely there's a Trailhead module for it!

Follow Eric on:
Twitter :

Blog :- -
If you want to share your Salesforce Success Story, Please feel free to drop me an email :-


Amit Chaudhary

Monday, 27 February 2017

Pre-Chat form for Live Agent | Post Chat / Pre Chat Form in salesforce | Live Agent Tutorial

Pre-Chat Form in Live Agent

In live Chat this is very common to collect some information about customer like name ,email and phone number. Providing that information to agent before they connect with customer will increase the agent's productivity as they won't have to ask those questions manually. With the help of Pre-Chat Form we can collect the same information for agent prior to start the chat.

Please follow below step to setup the Pre -Chat Form in Live Agent.

Step 1) Setup the live Agent
Please check below post how to configure Live Agent
PPT :-

Step 2) Create Pre-Chat form code.

<apex:page showHeader="false">

<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
<script type='text/javascript'>
(function() {
function handlePageLoad() {
var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
} if (window.addEventListener) {
window.addEventListener('load', handlePageLoad, false);
} else { window.attachEvent('onload', handlePageLoad, false);

<h1>Live Agent Pre-Chat Form</h1>

<!-- Form that gathers information from the chat visitor and sets the values to Live Agent Custom Details used later in the example -->
<form method='post' id='prechatForm'>
    First name: <input type='text' name='liveagent.prechat:ContactFirstName' id='firstName' /><br />
    Last name: <input type='text' name='liveagent.prechat:ContactLastName' id='lastName' /><br />
    Email: <input type='text' name='liveagent.prechat:ContactEmail' id='email' /><br />
    Phone: <input type='text' name='liveagent.prechat:ContactPhone' id='phone' /><br />
    Issue: <input type='text' name='liveagent.prechat:CaseSubject' id='subject' /><br />

<!-- Hidden fields used to set additional custom details -->
    <input type="hidden" name="liveagent.prechat:CaseStatus" value="New" /><br />
    <!-- This example assumes that "Chat" was added as picklist value to the Case Origin field -->
    <input type="hidden" name="liveagent.prechat:CaseOrigin" value="Chat" /><br />
    <!-- This example will set the Case Record Type to a specific value for the record type configured on the org. Lookup the case record type's id on your org and set it here -->
    <input type="hidden" name="liveagent.prechat:CaseRecordType" value="012D00123456789" />
    <!-- Used to set the visitor's name for the agent in the Console -->
    <input type="hidden" name="" id="prechat_field_name" />

<!-- map: Use the data from prechat form to map it to the Salesforce record's fields -->
<input type="hidden" name="" value="FirstName,ContactFirstName;LastName,ContactLastName;Email,ContactEmail;Phone,ContactPhone" />

<input type="hidden" name="" value="Subject,CaseSubject;Status,CaseStatus;Origin,CaseOrigin;RecordTypeId,CaseRecordType" />

<!-- doFind, doCreate and isExactMatch example for a Contact: 
    Find a contact whose Email exactly matches the value provided by the customer in the form 
    If there's no match, then create a Contact record and set it's First Name, Last Name, Email, and Phone to the values provided by the customer -->
<input type="hidden" name="" value="Email,true" />
<input type="hidden" name="" value="Email,true" />
<input type="hidden" name="" value="FirstName,true;LastName,true;Email,true;Phone,true" />

<!-- doCreate example for a Case: create a case to attach to the chat, set the Case Subject to the value provided by the customer and set the case's Status and Origin fields -->
<input type="hidden" name="" value="Subject,true;Status,true;Origin,true;RecordTypeId,true" />

<!-- linkToEntity: Set the record Contact record, found/created above, as the Contact on the Case that's created --> 
<input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Contact" value="Case,ContactId" />

<!-- showOnCreate: Open the Contact and Case records as sub-tabs to the chat for the agent in the Console -->
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />

<!-- saveToTranscript: Associates the records found / created, i.e. Contact and Case, to the Live Chat Transcript record. --> 
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="ContactId" />
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="CaseId" />

<!-- displayToAgent: Hides the case record type from the agent -->
<input type="hidden" name="liveagent.prechat.findorcreate.displayToAgent:CaseRecordType" value="false" />

<!-- searchKnowledge: Searches knowledge article based on the text, this assumes that Knowledge is setup -->
<input type="hidden" name="liveagent.prechat.knowledgeSearch:CaseSubject" value="true" />

<input type='submit' value='Chat Now' id='prechat_submit' onclick="setName()"/>

<!-- Set the visitor's name for the agent in the Console to first and last name provided by the customer -->
<script type="text/javascript">
   function setName() {
    document.getElementById("prechat_field_name").value =  
        document.getElementById("firstName").value + " " + document.getElementById("lastName").value;

<style type="text/css">
p {font-weight: bolder }

Sample code :-

Step 3) Configure the Pre-Chat code In Live Agent

1) Go to Setup -> Customize -> Live Agent --> Chat Button & Invitations

2) Edit Button setting and add VF page in Pre-Chat Form like below screen shot

3) Click Save

Related Link


Amit Chaudhary

Friday, 10 February 2017

Salesforce Tutorial | How to learn Test class | Test Class Best Pratice | Sample Test class | Test Factory

Apex Unit Tests

In Salesforce , the code must have 75% code coverage to be deploy in Production. This code coverage is performed by the test classes. Please check below post to learn about test classes in salesforce :-

1) Apex Testing

Please check above Trailhead module to learn more about test classes.

2) Best Practice for Test classes | Sample Test class

Please check above post to see how to write test class for Trigger , Standard Controller , Controller and StandardSetController . With Test Class best practice. 

3) Test Utility Classes | TestDataFactory | Util Test in salesforce

Test utility classes contain reusable code for test data creation. Please check above post for How to create Test Data Factory in salesforce with example.

4) Test classes with @isTest

Please check above post for  @isTest annotation uses and Limitation.

5) StartTest and stopTest Method


StartTest and StopTest are standard test methods which are available for test classes. Please check above post for StartTest and StopTest Method uses and Limitation.  

6) Salesforce Testing Best Practice Guidelines | Unit Test Mechanism in Salesforce | Test Methods

Please check above post for Unit Test Mechanism in Salesforce and for Test class Best practice.

7) Code Coverage Report in excel Format | Test Class Result in XLS

Some time we need to Download/Export the code coverage for each class in excel file . So same we can use the Code Coverage Report App. Please check above post for same



8) @testSetup ( Set Up Test Data for an Entire Test Class )

Please check above post how to create test data for entire test class.




Amit Chaudhary


Monday, 6 February 2017

Salesforce Apex Hours:- Live Agent | Farmington Hills Salesforce Developer Group

Farmington Hill Salesforce Developer group organized another successful event on 4th Feb 2017, focusing on Live Agent Chat. We are happy that this time we were able to complete some knowledge base session.

First of All I would like to thank to our Farmington Hills Salesforce Developer group members for there support. Now our Farmington Hills Developer Group family is increasing and now we are more the 111+ member in same group.

Agenda :-
• Live Agent Chat .
• Trailhead badges
• Games & Swag !

Our Sponsors :-
Thank you WorkForce Software and Tom Nieman to provide the space for our meetup this time.

Facebook Page :-
Meetup Link :- 

Twitter Tag :- #FarmingtonHillsSFDCdug
Live Agent PPT :-

Some Pic of our Meetup
Meetup Place :- WorkForce Software | 38705 Seven Mile Road, Livonia, MI

Amit Chaudhary

Thursday, 2 February 2017

Success Story of : - Mike Martin

Welcome to my 5th 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

[Mike Martin ] :- I am a Client Partner with Appirio.  I am responsible for building and growing relationships with Salesforce clients in the northern midwest.

2) Your success Story   

[Mike Martin ] :- I was introduced to the Salesforce Ecosystem when I started a new job as a Sales Engineer for a software company here in Indianapolis back in 2008.  The company had been using Salesforce for 3-4 years, and had a solid implementation, but the Salesforce product owner was leaving the company, and they needed someone to take over.  I spent most of my first 6 months in the role learning about Salesforce and connecting with the local Salesforce community, which was pretty small at the time.  As many also-admins learn, Salesforce became a huge part of my day to day job function, which led me to look to the ecosystem for my career path when it was time to move on from that organization.  The rest, as they say, is history!  I left that organization to join a small salesforce consulting company, which was then acquired by Appirio.  I've been incredibly lucky to be a part of such a salesforce focused organization.  Over my 6 and a half years here, I have been able to continue my involvement in the Salesforce community by stepping into a leadership role with the Indianapolis Salesforce User Group, and have been recognized as a Salesforce MVP.

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

[Mike Martin ] :-
1. Networking!  It's a great opportunity to meet other professionals in the same field and share ideas.
2. Learning!  Presentations are always informative, and there's always an expert on hand (or at least someone who has likely been through a similar situation or problem you may be facing!
3. Fun!  As you probably know about the Salesforce community, there are a lot of great people involved in the community, and I always look forward to User Group meetings to catch up with friends and contacts! ( Amit :- I agree Networking ,Fun and Learning )

4) Advice for new Salesforce Developer

[Mike Martin ] :- It’s been said, and I will say it again…the Community!  I was initially successful in the Salesforce ecosystem thanks to User Groups and Twitter, so I always encourage all new users to take advantage of resources local to them through the awesome User Group program.  Twitter, the Success Community, and of course now Trailhead are also great places to get started.

5) Trailhead badges

[Mike Martin ] :- 71 as of last count.  I'm an Expeditioner!  I hope to grab a couple more at the next Salesforce Indy User Group Trailhead Lockin, and level up to Ranger! (Amit :- All The best)

Follow Mike Martin on:
Twitter :  @mikemartin__c

 If you want to share your Salesforce Success Story, Please feel free to drop me an email :-


Amit Chaudhary

Friday, 27 January 2017

Test Utility Classes | TestDataFactory | Util Test in salesforce

Common test utility classes are public test classes that contain reusable code for test data creation.The TestDataFactory/ testutility  class is a special type of class — It is a public class that is annotated with @isTest and and as such, are excluded from the organization code size limit and execute in test context and can be accessed only from a running test.

Test utility classes/TestDataFactory contain methods that can be called by test methods to perform useful tasks, such as setting up test data.

Step 1:- Create TestDataFactory / Test utility
public with sharing class TestDataFactory 
    * ********************************************************
    * This method is test data for create Lead
    * ********************************************************

    public static Lead createLead(Boolean doInsert)
        Lead newLead = new Lead() ;
        newLead.FirstName = 'Cole';
        newLead.LastName = 'Swain';
        newLead.Company = 'BlueWave';
        newLead.Status = 'contacted';
            insert newLead;
        return newLead;

    public static Void convertLead(Lead newLead )
        database.leadConvert lc = new database.leadConvert();
        leadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
        Database.LeadConvertResult lcr = Database.convertLead(lc);
        lc.setOpportunityName('Cole Swain');
    * ******************************************************
    * This method is test data for create Account
    * ******************************************************
    public static Account createAccount(Boolean doInsert)
        Account acc = new Account();
        acc.Name = 'Test Account';
            insert acc;
        return acc;
     * *******************************************************
     * This method is test data for create contact object
     * *******************************************************
    public static Contact createContact(Boolean doInsert)
        return createContact(doInsert, createAccount(true).Id);
    public static Contact createContact(Boolean doInsert, Id accId)
        Contact con = new Contact();
        con.AccountId = accId;
        con.FirstName = 'FirstName';
        con.LastName = 'LastName';
        con.Email = '' + Math.floor(Math.random() * 1000);
            insert con;
        return con;

    * ***********************************************************
    * This method is test data for create Opportunity object
    * ***********************************************************
    public static Opportunity createOpportunity(Boolean doInsert, Id accId)
        Opportunity oppt = new Opportunity(Name ='New mAWS Deal',
                            AccountID = accId,
                            StageName = 'Customer Won',
                            Amount = 3000,
                            CloseDate =
            insert oppt;
        return oppt;
    * ************************************************************
    * This method is test data for create Case object
    * ************************************************************
    public static Case  createCase(Boolean doInsert )
        Case cas = new Case(Status ='New', Priority = 'Medium', Origin = 'Email');
            insert cas ;
        return cas ;

Step 2:- How to Use TestDataFactory / Test utility

private class MyTestClass 
    static testmethod void myUnitTest() 
        Lead leadObj = TestDataFactory.createLead(true);
        Account accObj = TestDataFactory.createAccount(true);
        Contact contObj = TestDataFactory.createContact(true,;
        Opportunity oppObj = TestDataFactory.createOpportunity(true,;
        Case caseObj = TestDataFactory.createCase(true);
    // If you want to edit data according to apex class then try like below
    static testmethod void myUnitTest1() 
        Lead leadObj = TestDataFactory.createLead(false); // pass false
        leadObj.LastName ='MyName';
        insert leadObj ;
        Account accObj = TestDataFactory.createAccount(false);
        accObj.Name ='MyName';
        insert accObj;

Please check below post for Test Class Sample :-

Some Useful link :-


Amit Chaudhary