You are on page 1of 85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

SALESFORCE CODING LESSONS FOR THE 99%


Finally, Apex tutorials for point-and-click admins! Written by a self-taught Google engineer.

BEGIN N ER TUTORIALS

LOGIN TO SFDC99

HOW TO READ CODE

ABOUT ME

Follow @dvdkliu for post updates!

Beginner Tutorials
M A Y

1 6 ,

2 0 1 3

Anyone can learn how to write Apex no matter what their background is!
Follow this guide in order and I guarantee you will become a Salesforce developer.

Announcement!
Step-by-step guide to becoming a Salesforce developer this Summer!

Chapter 0 The Basics


1. The best way to quickly learn how to code in Salesforce!
2. How to learn the non-coding side of Salesforce! (the free course is sufficient)

Chapter 1 Write Your First Trigger from Start to Finish!


1. What is a Salesforce Trigger?
2. Where to write code in Salesforce
3. Example: How to write an Apex trigger
4. Example: How to write a test class
5. How to deploy your code from sandbox to production
Chapter 1 Quiz!

How to write a Salesforce Trigger (Pa

How to write a Salesforce Trigger (Pa

0:00 / 6:15

0:00 / 7:37

P.S. Check out Salesforces official Dreamforce session on how to get started with Apex!

Chapter 2 SOQL: A Beginners Guide


http://www.sfdc99.com/beginner-tutorials/

1/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

1. What is SOQL and why should I learn it?


2. Where to write SOQL queries
3. Example: How to write a simple SOQL query
4. Example: How to write a cross-object SOQL query (upwards)
5. Example: How to write a cross-object SOQL query (downwards)
Chapter 2 Quiz!

Chapter 3 Core Apex Tools


1. Variables and data types strings, dates, numbers, and sObjects
2. Data collections lists, sets, and maps
3. Dot notation navigating relationships and using methods
4. Loops FOR and FOREACH loops
5. Comparison Operators
6. IF statements
7. Creating, updating, and deleting records
Chapter 3 Quiz!

Chapter 4 Write Your First Intermediate Trigger!


1. Intermediate triggers: Combining Apex with SOQL
2. Using Apex variables inside a SOQL query
3. Example: How to write a deduping trigger for leads and contacts
4. Principles of a good test class
5. Example: Write a test class for our deduping trigger
Chapter 4 Quiz!

Chapter 5 Bulkify Your Code!


1. What are Governor Limits?
2. The #1 most important Governor Limit
3. Why and how to Bulkify your Code
4. Introduction to Maps
5. Bulkify your code by combining SOQL queries
6. Use Maps to navigate across Lists
Chapter 5 Quiz!

Chapter 6 Advanced Apex Concepts


http://www.sfdc99.com/beginner-tutorials/

2/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

1. When to use before vs after triggers


2. Debug your code with System.debug
3. Comparing old and new values in a trigger
4. Sending emails using Apex
5. Change your trigger on the fly using Custom Settings
Chapter 6 Quiz!

Chapter 7 Write Your First Advanced Trigger!


1. How to simplify the most complex triggers
2. Turning a concept into code begin writing an advanced trigger!
3. Example: How to write an advanced trigger
4. Example: How to write an advanced test class
5. The biggest secret Apex developers dont want you to know!

Take the Hall of Fame Challenge and earn your spot in


SFDC99!
Chapter 8 Object Oriented Thinking
1. What are objects and how can they help me?
2. What laundry and object oriented programming have in common
3. Trigger design patterns

Chapter 9 Apex Outside of Triggers


1. Calling Apex from a button
2. Scheduling Apex jobs in a batch
3. Synchronous vs. Asynchronous methods

Chapter 10 Dynamic Apex


Chapter 11 Integrations
Chapter 12 Visualforce
Certifications and Careers
1. What type of Apex programmer are you?

Taking Apex to the limits, and beyond


http://www.sfdc99.com/beginner-tutorials/

3/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Advanced Apex Programming this guy literally wrote the book on Apex!

226 Comments

Tom B.
JU NE 1 4 , 2 0 1 4 @ 5 :1 1 PM

Hi David,
Not sure where to post this question so I posted here
How do you get the Developer Console to remember all the logs and various settings? I noticed that
when I close all the logs, pages, etc. and go back into the console they come back along with other
settings that I changed!
Reply

Jonathan Bernd
JU NE 1 2 , 2 0 1 4 @ 1 0 :1 6 PM

Hi David
LIke you Im completely self-taught (and not nearly as young:)). You are a big encouragement. I got my
Developers certification about a year ago, and now (if I can find time) want to get Advanced Developer
asap. Im just ordering HeadFirst Java. Id be grateful if you could point me in any other ways to get this
knowledge expediently.
I also need to gain vf chops.
Thanks
Reply

http://www.sfdc99.com/beginner-tutorials/

4/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JU NE 1 2 , 2 0 1 4 @ 1 1 :0 3 PM

Awesome stuff!!!
Force yourself to code! DEV 501 has plenty of Visualforce so you definitely need that
under your belt. Luckily VF is easy-ish to learn once you have the fundamentals
down in Head First Java. Standard documentation is plenty!
Basically find any excuse to code anything! You have all the resources you need to
learn right now but not enough experience!
Rep l y

Ankit Gupta
JU NE 1 1 , 2 0 1 4 @ 1 2 :0 2 A M

Hey David,
Hope you are doing good. Just a quick question on learnings from the first webinar.
My issue when i wrote a trigger:
In your trigger which you wrote, had 2 standard objects. What to do when you have 2 custom objects?
i am running the following trigger on Band object which would create a band member record. On band
member object there is a field which looks up to the band. Both Band and Band Member are custom
objects,
trigger Twitter on Band__c (after insert) {
for ( Band__c acc: Trigger.new )
{
Band_Members__c bandMember = new Band_Members__c();
bandMember.name = xyz@dasra.org;
bandMember.Twitter_handle__c = acc.Twitter_Handle__c;
bandMember.Band__c.Id= acc.Id;
insert bandMember;
}
}
this is throwing up the following error.
Error: Compile Error: Invalid foreign key relationship: Band_Members__c.Band__c at line 7 column 5
What do i do?? How do i get the correct id?
Reply

http://www.sfdc99.com/beginner-tutorials/

5/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JU NE 1 1 , 2 0 1 4 @ 5 :1 1 PM

Change that line to this!


bandMember.Band__c = acc.Id;
Explanation: Band__c is a lookup field, therefore you must set it to an ID! No need to
use dot notation and use Band__c.Id
Rep l y

Ankit Gupta
JU NE 1 2 , 2 0 1 4 @ 3 :3 7 A M

Hi David, thanks..it definitely works.


Here i have got another questionI have a multi select picklist field type both in child objects- Band member and
Parent object- Band. Now i want to get the chosen values of picklist type in band
member to the available values of the picklist type in band object. E,g: If type in
band member has values {guitar, drum, vocal, base programming} and i choose
guitar and drum hereso now type field in band object should show guitar and
drum values only among the available values.
%Following trigger copies the entire picklist from child object to the parent object.%
trigger Updateparent on Band_Members__c (after insert, after update) {
Set parents = new Set();
for (Band_Members__c child : trigger.new) {
if(child.Band__c != null){
parents.add(new Band__c(Id = child.Band__c, Type__c = child.Type__c)); // Copying type
from child to parent
}
}
if(!parents.isEmpty()){
List toUpdate = new List();
toUpdate.addAll(parents);
update toUpdate;
}
}
Can you please guide me what i should do?
http://www.sfdc99.com/beginner-tutorials/

6/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Reply

David Liu
JU NE 1 2 , 2 0 1 4 @ 1 0 :4 4 PM

Its easy to change the selected values of a multi-picklist but its


veryyyyyy difficult to change the possible values.
Youll need to look into the Metadata API if you want to do so! It will be
a nightmare to implement!
Rep l y

Manav
JU NE 8 , 2 0 1 4 @ 2 :4 7 A M

Hii David
Actually i m a marketing guy and now i left my job. Because i want to become salesforce developer. But
i dont know how to start and will i be able to do this. i am so confused. Please help me.Please!!!
Reply

David Liu
JU NE 8 , 2 0 1 4 @ 8 :2 0 PM

I went down the exact same path! (You can read more in the About Me page)!
Start at the beginner tutorials and youll be a developer in no time!
http://www.sfdc99.com/beginner-tutorials/
Rep l y

http://www.sfdc99.com/beginner-tutorials/

7/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

sreenu
JU NE 5 , 2 0 1 4 @ 5 :1 4 A M

hiii david
this is sreenu.actually i dont have any coding experience.i want become a good programmer.please
help me.how to i learn programming in simple way..what books are refferedplease tell mei am
waiting for your reply
Reply

David Liu
JU NE 8 , 2 0 1 4 @ 8 :2 9 PM

This page has everything you need to know, let me know if not!
http://www.sfdc99.com/beginner-tutorials/
Rep l y

Jithu
JU NE 5 , 2 0 1 4 @ 3 :1 2 A M

Hi David,
sorry! to say this i think i am enough prepared to write trigger on any task but the problem i face is that
the code length whereas other experts take 10 line of code and i take 20 for the same task can you help
me out from this. so that how can i make my code short and best??
Reply

David Liu
JU NE 8 , 2 0 1 4 @ 8 :2 6 PM

That will come over time! Try to read other peoples code and youll learn what
shortcuts they use =)
Shorter isnt always better the best code is the one thats easiest to understand,
http://www.sfdc99.com/beginner-tutorials/

8/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

even if it takes 10 more lines of code!


Rep l y

Jithu
JU NE 8 , 2 0 1 4 @ 1 0 :0 7 PM

Thank u!! David


Reply

Sumit Rana
JU NE 4 , 2 0 1 4 @ 9 :2 0 A M

Hi David,
Thanks for the reply. I did this with the workflow, but now want to do this through code.. just to
improve my coding skills and my knowledge.. Ill just look into things deeper now..
Thanks
Reply

Sumit Rana
JU NE 3 , 2 0 1 4 @ 1 0 :5 8 A M

Hi David,
Can you help me with this. I need to write a trigger to create and assign a dummy task to account
owner on account creation if reporting country of account owner is India
(The account owners reporting country is a tricky part for me) :(
Thanks
Reply

http://www.sfdc99.com/beginner-tutorials/

9/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JU NE 3 , 2 0 1 4 @ 8 :0 9 PM

You can actually do this with a workflow no need for a trigger!


Try to figure out what reporting country means to you imagine youre a
computer and only understand basic inputs!
Rep l y

Barry
M A Y 3 1 , 2 0 1 4 @ 1 0 :3 9 A M

Hi David,
Your site is a great help, I am a beginner and this really helps.
On the Developer Edition I would like to add Quotes as an option on the Tabs at the top, cannot find
out how to do this. Can you please let me know how I can do this.
Thank you
Barry
Reply

David Liu
JU NE 1 , 2 0 1 4 @ 7 :2 1 PM

There is no standard Quotes tab =) You simply create them from the Opportunity!
Rep l y

Justin Wong
http://www.sfdc99.com/beginner-tutorials/

10/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


M A Y 2 8 , 2 0 1 4 @ 9 :1 1 A M

Hi David, this is really great information that you have put together. I come from a Java background
and this really puts it in a great perspective how you can learn SFDC in more efficient manner. Couple
of questions that I have.
1. Do you use Eclipse? If so do you recommend using it?
2. How can we setup source control for SFDC?
Thanks,
Justin
Reply

David Liu
M A Y 2 8 , 2 0 1 4 @ 6 :4 1 PM

Most of the time I do use Eclipse! Nowadays though I find myself using the web ui or
developer console more and more. Theyre getting much better each release!
A lot of companies use source control (git, etc) but a surprisingly large amount dont
=) Salesforce doesnt do it out of the box so most companies just override their code
over and over! Havent set it up specifically but I would be shocked if there wasnt a
good tutorial on it somewhere on the web =)
David
Rep l y

sen
M A Y 2 7 , 2 0 1 4 @ 8 :0 9 A M

i believe you said i should not worry about the webinar if i am going through the chapters right? or
should i stop and watch webinars that you have posted. sorry if i asked this before!
Reply

David Liu
http://www.sfdc99.com/beginner-tutorials/

11/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


M A Y 2 7 , 2 0 1 4 @ 1 2 :5 4 PM

Immerse yourself in code =) You will learn things in the webinar that are not taught
on this site, and vice versa! The small time investment will give you lots of ROI!
Rep l y

sen
M A Y 2 7 , 2 0 1 4 @ 8 :0 5 A M

david, can i use your free account to do your chapter exercises? also, if i wanted to just use the code
you do in your chapters i would just kinda copy that code and just paste and see if it runs just like you
show in your examples right?
last question is sandbox. do we as developers have to create a sanbox or is it created for us. i kinda
dont understand where a sandbox is and how to get there etc. the only thing i ever use is a freed
developer account on the free trail. i am plowing through your chapters as i stated to you =)
also when you deploy you have to do inbound and outboud change sets right? you can just do change
stets by using setup menu and then hitting deploy on whatever you have done in your sanbox.
getting this terminology down is my desire. like what is environment vs org and what is test org etc? I
saw your video series and i would like to commend your work! keep it up sir! i hope you become super
successful!
thanks!
Reply

David Liu
M A Y 2 7 , 2 0 1 4 @ 1 2 :5 5 PM

Take a second look at Chapter 1 all these things are covered Sen!
Rep l y

http://www.sfdc99.com/beginner-tutorials/

12/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Harsha
M A Y 1 9 , 2 0 1 4 @ 1 1 :1 1 A M

Hi David,
When will be the webinar video of May 15th session is available?
Reply

David Liu
M A Y 1 9 , 2 0 1 4 @ 7 :0 3 PM

Hhhmm dont know yet but Ill ask the crew when I see them this week!
Rep l y

Harsha
M A Y 2 0 , 2 0 1 4 @ 1 2 :0 2 A M

Thanks.
Reply

gousia
M A Y 1 9 , 2 0 1 4 @ 1 2 :3 4 A M

Hi David,
eagerly waiting for your next post on object oriented thinking.i learned triggers by practicing ur 1 to 7
chapters.now in the market who knows vf pages n triggers are getting jobs quickly.iam a jobseeker in
sfdc..so plzz post those lessions if u find free time.thanks alot for ur support.this is the best site to
learn sfdc till my all searches.so plzz try to post early
Thank u David.
Reply

http://www.sfdc99.com/beginner-tutorials/

13/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
M A Y 1 9 , 2 0 1 4 @ 7 :0 1 PM

Well done!!!
If you havent already read the book, give Head First Java a try as itll teach you
object oriented thinking!
Going as fast as I can hahaha
Rep l y

Anonymous
M A Y 2 2 , 2 0 1 4 @ 4 :2 7 PM

Hi David
Im a Java programmer but interested to learn Apex. Do I still need to read this book?
Thanks
Reply

David Liu
M A Y 2 2 , 2 0 1 4 @ 5 :1 3 PM

Java programmer no need for the book, jump right in!


Rep l y

Ofelia H. Ladao
M A Y 1 7 , 2 0 1 4 @ 8 :4 5 A M

http://www.sfdc99.com/beginner-tutorials/

14/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hi David,
Reply

David Liu
M A Y 1 7 , 2 0 1 4 @ 1 0 :2 7 A M

Hi Ofelia =)
Rep l y

Chris Kim
M A Y 1 5 , 2 0 1 4 @ 9 :3 4 PM

YOU rock man! My Java book is arriving tomorrow and I will be reading away and taking be on this site
all weekend! Quick question, will you have something for us to become a developer of VisualForce? I
understand it can use HTML and or Javascript?
Reply

David Liu
M A Y 1 7 , 2 0 1 4 @ 1 0 :4 8 A M

Visualforce is coming up right after I talk about something even more important
object oriented thinking!
Rep l y

Paul
M A Y 1 5 , 2 0 1 4 @ 8 :5 8 A M

http://www.sfdc99.com/beginner-tutorials/

15/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hi, firstly thanks so much for creating sfdc99, what a great find!
Ive just started looking at Apex today as I need to go beyond the point-and-click adventure I have had
so far with Salesforce. Working for a UK charity with no budget means I am reliant on self education
and this site has helped enormously, but.
At the risk of preempting Chapter 9 I have a specific requirement and Id appreciate your comment on
my proposed solution:
We have a thriving web site (www.nfm.org.uk) with a web form to allow prospective clients to self-refer
(referral form). Currently that form gets emailed to the admin team and copied into Salesforce. The
form software can write directly to Salesforce so I set up a custom object to receive the data
(Web_Referrals). Now I need to copy that data to 2 existing objects to create Case and 2 Clients
linked (master-child) to that Case assuming the data is ok.
So I thought just stick a custom button on the Web_Referrals detail screen, write some Javascript to call
an Apex class/method. Ive written some dummy code to emulate creating a case but cannot work out
how to reference the Referrals fields in the Apex code.
Am I going about this the right way? Ive googled it to death but cannot find the answer so any
tips/advice/pointers to other resources would be welcomed,.
Javascript:
{!REQUIRESCRIPT(/soap/ajax/15.0/connection.js)}
{!REQUIRESCRIPT(/soap/ajax/15.0/apex.js)}
sforce.apex.execute(createWebReferralCase, createNewCase, {});
window.alert(Case Created);
Class:
global class createWebReferralCase
{
WebService static void createNewCase()
{
Mediation_Case__c caseToCreate = new Mediation_Case__c();
// add some data
caseToCreate.Name = Web_Referral__c.C1_Last_Name__c; // doesnt work!
caseToCreate.Referral_Date__c = date.today();
// insert the new case
insert caseToCreate;
}
}
Reply

Paul
M A Y 1 6 , 2 0 1 4 @ 2 :3 1 A M

Please ignore this, I did find the answer eventually via the developer forum. I enjoyed the first
http://www.sfdc99.com/beginner-tutorials/

16/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

webinar yesterday, very inspiring.


Reply

sameer
M A Y 1 5 , 2 0 1 4 @ 1 :3 5 A M

hii david,
i am beginner in salesforce, i want to ask u 1 que.
can we convert read only field instead of required field in standard field through page layout??
Reply

David Liu
M A Y 1 5 , 2 0 1 4 @ 2 :2 5 PM

You sure can just need to lock the field on the page layout editor! Depending on
your use case you can also use a validation rule.
Rep l y

Kevin
M A Y 1 4 , 2 0 1 4 @ 3 :5 5 PM

Hi David!!! I just finished your tutorials a couple of weeks ago, they are amazing!!! Thank yo much.
I was wondering if you can answer me a question is it possible to access an apex:inputHidden on a
VF page from the controller??
Reply

http://www.sfdc99.com/beginner-tutorials/

17/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
M A Y 1 5 , 2 0 1 4 @ 2 :2 6 PM

Yup should be possible but need to understand your use case as there may be a
better solution!
Rep l y

Nitin Saxena
M A Y 1 3 , 2 0 1 4 @ 1 0 :3 1 PM

For those who are very new to the Salesforce.com , You can refer Salesforce Fundamentals Help
document here : http://www.salesforce.com/us/developer/docs/fundamentals/index.htm
I found it useful, thought to share :)
Reply

David Liu
M A Y 1 3 , 2 0 1 4 @ 1 1 :3 9 PM

Thank you Nitin for sharing!


Rep l y

Srinivasan.S
M A Y 7 , 2 0 1 4 @ 1 :2 1 PM

Hi David,
I have worked as a windows admin.When I came to know about Salesforce and its development and
demand,I want to become a Salesforce developer like you.I want tom follow your path for that so I have
started you steps.I want to become Salesforce developer this summer and want to participate in this
years Dreamforce Event.Please guide for my dream.

http://www.sfdc99.com/beginner-tutorials/

18/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Reply

David Liu
M A Y 7 , 2 0 1 4 @ 9 :5 8 PM

This guide is all you need Srinivasan!


http://www.sfdc99.com/2014/04/28/step-by-step-guide-to-becoming-a-salesforcedeveloper-this-summer/
Rep l y

gousia
M A Y 3 , 2 0 1 4 @ 7 :3 6 PM

Hi David,
In everyones mind there will be a doubt when to use before vs after triggers.the way u expalined is
excellent .i dont have words to tell, how much these lessions r helping me and building confidence in
me.
i have so many doubts in apex classes and vf pages.if possible please write those lessons alsoas they
r most imp in interview point of view.
Thanks in advace.Thanks alot for ur tutorials.
Reply

David Liu
M A Y 6 , 2 0 1 4 @ 1 0 :5 6 PM

Thank you Gousia! YOU CAN DO IT!!!


Apex classes are coming up next!
The Visualforce!
Then how to get a job!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

19/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Sen
M A Y 2 , 2 0 1 4 @ 1 2 :4 5 PM

Another question sir


where can i practice code? like when i see your tutorial and i want to copy and get same results? is it
the inline editor in the free developer environment for visual force pages?
can you tell me steps how to start using a vf page? create a class , create a controller etc? I heard most
people use inline editor once you create a page to code? some people said developer console? i have
no idea what that is?
some terms if you can clarify
what are classess? public? private? test?
what are governor limits?
what are standard/custom controller? how do you create both?(sample code)
lastly i dont understand the bracket usage for code( sorry i am really new to code)
in general when you type a line of code do you put opening bracket like this { and closing bracket }
that ends one line of code? some of those brackets confuses the heck out of me. i forgot the rules. I
also dont understand the little . and other stuff in the lines of code. it looks alien but i will try to grasp
it. i am trying to learn some in thatwebsitecalled ww3schools for beginners.
bear with me i only have two more questions i will ask you and then try to tackle myself.
I apologize for the inconvenience.
you rock! I would like your autograph one day for being a coding hero!
Sen
Reply

David Liu
M A Y 2 , 2 0 1 4 @ 1 0 :1 9 PM

Some of these questions are way too advanced for you to worry about right now
hahaha. Once youre comfortable with topics in chapters 0 7 you can begin
researching these things!
Think of brackets as simply layers of code. Youll become more comfortable with it
http://www.sfdc99.com/beginner-tutorials/

20/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

as you go through the chapters on this site =)


P.S. things like Javascript, HTML/CSS, and other technologies on w3schools arent
really helpful for learning Apex! You have to learn Apex before learning Visualforce
(otherwise you will be really confused, which is probably why youre pretty confused
right now). Then, while learning Visualforce, you should learn HTML/CSS. Javascript
comes after that =)
Go get em!!!
David
Rep l y

Sen
M A Y 5 , 2 0 1 4 @ 5 :0 9 A M

David i think i will do this. I will follow what you say rather than asking questions.
so lets do this step by step.
first step is
do chapters 0-7? correct? i will be able to grasp this without that javabook? the only
reason i showed those video is because i cant but that java book and i need to start
some learning and not waste timeetc.
so anyway, say yes/no to the step i mentioned and then we will do next step. like that
you can guide me and i wont ask anything else until i complete that step.
do you like this idea sir?
Sincerely,
Sen
Reply

David Liu
M A Y 6 , 2 0 1 4 @ 1 0 :5 8 PM

hahaha yes Sen! And no need to call me sir, I am simply your friend who
is still learning as well =)
Rep l y

http://www.sfdc99.com/beginner-tutorials/

21/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Sen
M A Y 7 , 2 0 1 4 @ 2 :2 2 PM

Thanks. I will contact you after i am done with chapter 7. would that be
enough knolwedge to start as a noob developer in a company ? =) Is your
webinar about these chapters? should i watch it or continue with this stuff
as you suggested.

David Liu
M A Y 7 , 2 0 1 4 @ 9 :5 9 PM

Chapter 7 is more than enough to be able to write 95% of triggers!


The webinar will not go into that depth however you will learn
many of the intangibles!

Sen
M A Y 2 , 2 0 1 4 @ 1 2 :3 2 PM

Hey i am trying to get a job as a salesforce developer.


here is my background: i just played around a little bit with free developer environment and did some
basic stuff like create custom objects and some apps. I dont know much about admin stuff. I am just
learning javascript and trying to remember html.
here are my questions.
1) i know you need javascript for apex and i really dont have much time to for a book so i am using this
link(please look at it quickly). do you think this is good fro me to move ahead to apex guide you have
from chapter 0? I mean i dont have much time and i think i can pcik other stuff on job. also is html used
for apex? what about css? would i have to learn these as well to understand the code you write in apex
for salesforce?
2)as far as admin goes like i said i only played around with basic stuff like creating accounts etc. i know
you gave a link to what admin concepts we need before we code. would watching those short 2 min
salesforce videos on all the areas you gave in your link be enough? again i am trying to get job in three
weeks and dont have much time. how much admin stuff would we really need as developer? i mean i
dont see it as a prereq for developer and we dont use it on our job correct? i certainly dont know
anything about territory management and currency management etc. would we need this?
http://www.sfdc99.com/beginner-tutorials/

22/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

3) lastly if i follow your guide from chapter 0 to the bottom would i have adequate skills to go as entry
level developer? i am using your beginner tutorial to prepare i have no previous code experience and
not much admin experience.
am i fool for trying =)
thanks for your help!
Sincerely,
newbie
Reply

David Liu
M A Y 2 , 2 0 1 4 @ 1 0 :1 5 PM

Hey Sen,
I totally understand that you want to learn Apex as quickly as possible. Thats why I
made this site so that you could focus on just the important lessons and avoid all
the unnecessary stuff.
Check out this post for a step-by-step guide to learning:
http://www.sfdc99.com/2014/04/28/step-by-step-guide-to-becoming-a-salesforcedeveloper-this-summer/
Please, I beg you, put in the time to study and dont take any shortcuts. The only
person you end up cheating is yourself! You can be a developer by the end of
Summer. Thats really quick and its going to change your entire life! 5 10 hours a
week for a few months is all it takes.
Resiliency is your #1 skill as a developer!
http://www.sfdc99.com/2014/04/23/what-is-resiliency/
Life is all about priorities Sen. There are going to be times where youll have to
prioritize learning code versus having fun, hanging out with friends, partying, etc.
The small choices you make in these scenarios will add up over time and determine
where you end up in life!
I will help you every step of the way Sen. But I can only point you in the right
direction. Study. Work hard! Help me help you! I believe you can do it =)
David
Rep l y

Pingback: Salesforce Developer Skills Lead to Dream Job - SkyOffice Consulting | SkyOffice
http://www.sfdc99.com/beginner-tutorials/

23/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Consulting

Srinivas
A PRIL 2 2 , 2 0 1 4 @ 5 :0 3 A M

Hi david,
This is Srinivas,May i know how to create a field in an object by using apex tags..? u understand my
question right>creating fields to an newly created object..Thanks in advance.
Thanks,
Srinivas
Reply

Pankaj Kumar
A PRIL 2 1 , 2 0 1 4 @ 1 2 :3 7 PM

Hi David, Amazing postswished, all the topics you mentioned above was covered.Waiting for them to
come in future is a bit painful.But, thankx for all the Hard effort you are putting in explaining ur
followers on this site. I have a basic question related to deployment. When deplying from Sanbox to
Production we need overall coverage of 75% minimum. Is this code coverage limit same for Sanbox to
sandbox org. Or we can deploy without 75% overall code coverage.
Reply

David Liu
A PRIL 2 1 , 2 0 1 4 @ 8 :2 4 PM

Time flies =) I still remember struggling to write the first chapters a few months ago,
and here we are today!
Focus on learning the concepts up to Chapter 7 very deeply! The rest is easy =)
Sandbox to sandbox doesnt require any code coverage, so youre good to go!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

24/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

swan
A PRIL 2 0 , 2 0 1 4 @ 5 :3 5 A M

Hi David,
Gud morning.
I am new bie to salesforce planning to learn salesforce seeing the job market is high. But i dont know
programming so was wondering what percentage of programming does salesforce developer course
includes .
I am worried if this is right choice to choose salesforce as career can non programmer learn the
developer course.
please provide ur inputs. will be gratefull.
awaiting for the reply!!
Thanks
Reply

David Liu
A PRIL 2 0 , 2 0 1 4 @ 3 :0 8 PM

Check these posts out!


http://www.sfdc99.com/2014/04/15/dealing-with-doubt/
http://www.sfdc99.com/2014/04/17/hard-work-beats-talent/
The market is HOT and anyone can learn no matter what their background is!
Rep l y

hugh
A PRIL 2 1 , 2 0 1 4 @ 9 :0 7 A M

Great stuff You must be a mind reader just starting out as a salesforce developer the market
is defo hot.. Hope you the the last few links added. Thanks mate
Reply

http://www.sfdc99.com/beginner-tutorials/

25/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
A PRIL 2 1 , 2 0 1 4 @ 8 :2 0 PM

I am often told that I am hurting my own job prospects by increasing the


competition against me in the industry!
Im just happy to make a difference!
Rep l y

Harsha
A PRIL 1 8 , 2 0 1 4 @ 1 1 :5 3 PM

Hi David
This is a wonderful website for beginners like myself , i have followed the steps mentioned in here and
have managed to successfully run the test class, but my question is , how do i put this code in to use, i
mean in real time , like when the class is executed new user should be created,i am using the free
developer edition and dont have access to sandbox.
Really appreciate your efforts.
Thanks in advance.
Reply

David Liu
A PRIL 1 9 , 2 0 1 4 @ 1 2 :0 1 A M

If you have access to an Enterprise Edition of Salesforce you can deploy it using the
steps in this chapter!
Otherwise you cant deploy from a free developer edition! Dont worry though, that
part is easy so youre not missing out!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

26/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Srinivas
A PRIL 1 7 , 2 0 1 4 @ 1 0 :2 0 A M

Hi David,
May i Know how to create radio button???please let me know thatthanks in advance..
Reply

David Liu
A PRIL 1 7 , 2 0 1 4 @ 8 :5 4 PM

Here you go sir =)


https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_selectRadio.htm
Rep l y

Srinivas
A PRIL 1 8 , 2 0 1 4 @ 1 2 :5 5 A M

sir,cant we done without apex tags????


Reply

Pradeep Naredla
A PRIL 1 4 , 2 0 1 4 @ 8 :3 3 PM

hai mate,
actually i have a query can u pls help me.
my question is how to represent the campaign lookup field in lead can u pls tell me the api name of
that.
Reply

http://www.sfdc99.com/beginner-tutorials/

27/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
A PRIL 1 4 , 2 0 1 4 @ 8 :3 7 PM

Here you go =)
[SELECT Id, LeadId, CampaignId FROM CampaignMember WHERE LeadId =
'0123456789'];
If you must do it from Leads:
[SELECT Id, (SELECT Id, CampaignId FROM CampaignMembers ORDER BY CreatedDate
ASC LIMIT 1) FROM Lead WHERE LeadId = '0123456789'];
Go get em!
David
Rep l y

hima bindu
A PRIL 1 3 , 2 0 1 4 @ 7 :3 8 A M

hi , i am new to sfdc, this blog is v helpful..but i can see only 7 chapters, to see chaper 8 do i need any
extra privilege or it is yet to be posted??
Reply

David Liu
A PRIL 1 3 , 2 0 1 4 @ 8 :5 0 PM

Still working on writing them Hima (sorry!). I usually write 2 3 posts a week!
Rep l y

Xavier
http://www.sfdc99.com/beginner-tutorials/

28/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


A PRIL 7 , 2 0 1 4 @ 1 :1 0 PM

HI, David. Thank you for sharing your knowledge in such an easy to understand form. I get excited
whenever you have a new entry up.
Reply

David Liu
A PRIL 7 , 2 0 1 4 @ 7 :3 5 PM

Glad you enjoy it Xavier, I believe in you!


Rep l y

Tony Thoman
A PRIL 4 , 2 0 1 4 @ 6 :5 4 A M

David, I am new to salesforce development and have been tasked with keeping an existing ERP systems
Contacts in sync with any new contact entered into to Salesforce. Can this be accomplished with an
After Insert trigger and would this be the best approach for such an operation? Thanks, Tony
Reply

David Liu
A PRIL 4 , 2 0 1 4 @ 1 0 :3 5 PM

An after trigger could certainly do this, but this project is much bigger than you
might expect!
Integrations are best left to tools like Boomi:
http://www.boomi.com/
I would only recommend coding your own integration if youre very comfortable with
code, IE coding chapter 7 triggers in your sleep!
Rep l y

http://www.sfdc99.com/beginner-tutorials/

29/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Matt Santy
M A RC H 3 1 , 2 0 1 4 @ 8 :3 6 A M

Hey David, please feel free to shoot me an email of your chapter drafts if you want any help with text
editing, code scenarios, or just a second set of eyes. Keep it UP!!!
Reply

David Liu
M A RC H 3 1 , 2 0 1 4 @ 5 :5 9 PM

Thanks Matt I will keep you in mind!


Rep l y

Sanjay
M A RC H 2 5 , 2 0 1 4 @ 2 :5 5 PM

What are Schedule classes or Scheduled batch jobs?What is its use?


Reply

David Liu
M A RC H 2 6 , 2 0 1 4 @ 4 :3 6 A M

Hey Sanjay,
Sometimes you need to make large database changes that arent possible due to the
Governor Limits in a trigger.
For example, you might have an integration with an external system where all
records need to be synced at least on a daily basis. You couldnt do this with a
http://www.sfdc99.com/beginner-tutorials/

30/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

trigger because youd run into a 50,000 record limit. However with batch Apex, you
have much larger limits and can do this no problem!
Since you wouldnt want to manually call your batch Apex every night, youd use
scheduled Apex to automatically call your batch Apex every day.
Hope this helps!
David
Rep l y

sanjay kumar
M A RC H 2 6 , 2 0 1 4 @ 3 :1 6 PM

Got it!Thanks for your valuable comments.


Another question regarding test classes and code coverage.
Ques:
1) what are test class?
2) what we write in test class?
3) what is the need to write them?
4) how they actually work?
5) how we increase the code coverage if less than 75%?
Note:I know the theoretical concept that tells us that if code coverage is more than
75% then u can upload that class from sandbox to prod.Can you please clarify more!
Regards,
Sanjay
Reply

David Liu
M A RC H 2 7 , 2 0 1 4 @ 1 2 :5 5 A M

Hey Sanjay,
You definitely want to check out this post!
http://www.sfdc99.com/2013/05/14/how-to-write-a-test-class/
You can look at the Extended look link at the bottom if you want even
more detail =)
The 75% number is simply a random cutoff that Salesforce chose. In a
http://www.sfdc99.com/beginner-tutorials/

31/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

lot of cases its impossible to reach 100% code coverage. For example,
you might have a trigger that runs 1,000 different scenarios depending
on certain conditions. To test all 1,000 would be crazy, so Salesforce
lowered it and make it only 75% of all possible lines of code.
If your coverage is under 75% it simply means at least 25% of the lines
of code in your trigger never ran. Youd need to write more tests to
make those run!
Hope this helps!
David
Test class
Rep l y

sanjay
M A RC H 3 0 , 2 0 1 4 @ 1 :0 4 PM

Thanks Bro!
David ,can we design a complete website using Vf coding (Vf pages combined
together) and is it compulsory,if i have designed it for my customers,they also
have login first in salesforce then they can access my site.for e.g-i run a grocery
store ,i want my customers to purchase grocery online using my website and i
have designed a website using VF pages and apex classes and i want my end
users to access it.is it possible,if they can access it across internet and no need
to login first in salesforce.?Please explain.
thanks
Reply

David Liu
M A RC H 3 1 , 2 0 1 4 @ 6 :5 4 PM

Hey Sanjay,
I know this is definitely possible however I have no experience in
this area! Try Site.com perhaps!
David

http://www.sfdc99.com/beginner-tutorials/

32/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

sanjay
M A RC H 2 3 , 2 0 1 4 @ 4 :0 8 A M

The page gets refreshed everytime ,i click on Sum Button.I want that page should not get refreshed
when i hit for Sum Button,what changes shall i make.
My class looks like:
public class AddNumbers
{
public integer a{set;get;}
public integer b{set;get;}
public integer c{set;get;}
public void add()
{
c=a+b;
}
}
VF Page
Regards,
Sanjay Kumar
Reply

David Liu
M A RC H 2 3 , 2 0 1 4 @ 1 1 :5 6 A M

Hey Sanjay,
Visualforce code in comment doesnt render well!
Without knowing your code, what you probably want to do is add a rerender
element on your command button. The rerender should point to the outputpanel
containing your Sum field.
Good luck!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

33/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Code Riders
A PRIL 1 7 , 2 0 1 4 @ 1 :3 9 A M

Hi sanjay ,
read the below.
A button that is rendered as an HTML input element with the type attribute set to
submit, reset, or image, depending on the tags specified values. The button executes
an action defined by a controller, and then either refreshes the current page, or
navigates to a different page based on the PageReference variable that is returned by
the action.
IF you dont want to get the page refreshed then u might use the HTML input
buttoninstead of apex:button
Reply

David Liu
A PRIL 1 7 , 2 0 1 4 @ 8 :5 2 PM

Thanks!
Rep l y

sanjay
M A RC H 2 3 , 2 0 1 4 @ 4 :0 4 A M

The page gets refreshed everytime ,i click on result Button.I want that page should not get refreshed
when i hit for result, button,what changes shall i make.
My class looks like:
public class AddNumbers
{
public integer a{set;get;}
public integer b{set;get;}
public integer c{set;get;}
public void add()
{
c=a+b;
}
}
http://www.sfdc99.com/beginner-tutorials/

34/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

VF Page looks like:


Regards,
Sanjay Kumar
Reply

prem kumar
M A RC H 1 9 , 2 0 1 4 @ 1 2 :0 9 PM

David thank u so much, i just started learning and i am feeling so confident now.
when will you update chapter 7 waiting for them. eagerly waiting for the integration part.
Reply

David Liu
M A RC H 1 9 , 2 0 1 4 @ 9 :4 3 PM

ooo baby glad youre enjoying it tell your friends!


I finish about a chapter a month, so a few months from now hahaha.
Rep l y

jenish shingala
M A RC H 1 9 , 2 0 1 4 @ 1 2 :0 2 A M

After 6 lessions how to learn all remaing lessions?????


Reply

http://www.sfdc99.com/beginner-tutorials/

35/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
M A RC H 1 9 , 2 0 1 4 @ 9 :4 2 PM

Hey Jenish,
I havent yet written them =(
David
Rep l y

Ayan Hore
M A RC H 1 8 , 2 0 1 4 @ 6 :3 2 A M

Sorry, it seems the tag got missed out:

Reply

David Liu
M A RC H 1 8 , 2 0 1 4 @ 7 :1 8 PM

Hahaha my site html encodes all comments, so you need to type:


For <, type & lt ; without spaces
For >, type & gt ; without spaces
Rep l y

Ayan Hore
M A RC H 1 8 , 2 0 1 4 @ 5 :1 2 A M

Hi Yaniv,
As far as my understanding on #9 goes, Salesforce does some native rendering automatically once you
http://www.sfdc99.com/beginner-tutorials/

36/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

access the application from mobile (Salesforce1). For that you need to enable some options in your
settings (mobile settings, Salesforce1, etc).
Apart from that, when you create VF pages, you will see an option (checkbox) to enable it for mobile
rendering as well (since VF pages are customized, so standard SFDC mobile rendering will not apply for
them unless you select that checkbox).
Also I found some device level tags like below that you can use:
Also, you can trim off the header and the sidebar from your VF page for better viewing in mobile.
Im sure there are some more details, just do some googling and you will get it.
Let me know if it helps!
~Ayan
Reply

David Liu
M A RC H 1 8 , 2 0 1 4 @ 7 :1 7 PM

Thanks for the assistance Ayan!!


Rep l y

Bernard Mesa
M A RC H 1 4 , 2 0 1 4 @ 1 2 :5 6 PM

Hello!
Im a developer working in SalesForce. Thank you so much for this site! I generally find it difficult to get
decent help with developing in SalesForce, but your site is amazing! Thank you!
Reply

David Liu
M A RC H 1 5 , 2 0 1 4 @ 1 1 :3 3 A M

My pleasure Bernard! Very exciting announcement about the site coming up!!

http://www.sfdc99.com/beginner-tutorials/

37/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Rep l y

Athena
M A RC H 1 3 , 2 0 1 4 @ 1 :4 9 A M

Hi David,
Your Site helped a lot.Thanks for guiding!!
Want some sites or materials from where i can study -to pass ADM201?please help!! The sites I found
were 2-3 years old so will not help me with current exam since sales force updating every season.
Reply

David Liu
M A RC H 1 3 , 2 0 1 4 @ 9 :5 4 PM

Hey Athena,
Check out Quizlet.com and search for flashcards related to ADM201! I passed four
certifications studying almost exclusively off this strategy.
David
Rep l y

Anonymous
M A RC H 1 4 , 2 0 1 4 @ 5 :4 2 A M

Thanks:)
Reply

http://www.sfdc99.com/beginner-tutorials/

38/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Mayank Jain
M A RC H 1 3 , 2 0 1 4 @ 1 :2 3 A M

Hi David,
I have a requirement that through custom VF page i am editing Account information like Account
Name, Account Owner,Parent Account etc.
So I have created a Custom VF page but now I want to add condition to display different fields based on
the Account Record type.
AS their are two record types in Account :
1) Person Account: In this type of account First Name and Last name is required.
2) Business Account: In this Account Name is required.
So I want to display First name and Last name when admin select Record Type =Person Account and
display Account Name when admin select Record Type =Business Account. in VF page.
Reply

David Liu
M A RC H 1 3 , 2 0 1 4 @ 9 :5 3 PM

The rendered tag is your best friend here =)


Example:
Rep l y

Mayank Jain
M A RC H 1 3 , 2 0 1 4 @ 1 0 :3 3 PM

Hi David,
Could you please give some examples on rendering or some sample code.As I am
new in SFDC.
Reply

David Liu
http://www.sfdc99.com/beginner-tutorials/

39/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


M A RC H 1 3 , 2 0 1 4 @ 1 0 :4 8 PM

Oops darn commenting system hid the example!


Example:
<apex:inputField value={!account.FirstName}
rendered={!account.RecordTypeId == 1234567890} />
Rep l y

Yaniv
M A RC H 1 1 , 2 0 1 4 @ 9 :3 6 PM

Hi David Liu,
i am Yaniv myself, appreciate your work here.
i would like to know some details mentioned below.
1. What is Standard Set Controller. In which scenario it will use?
2. What is the purpose of Grant option in OWDs?
3. How to control the Workflow actions in Triggers?
4. How to load both the master and detail records at a time into database using SOQL query?
5. How to create Wizards in Salesforce?
6. What is the admin permission exist in PROFILEs to enable/disable DEBUG MODE option?
7. How to upload documents using Data Loader?
8. What is OAUTH and purpose in Salesforce?
9. What are all the changes needed in Visualforce pages and Apex classes to convert a web application
to a mobile application?
10. What are Analytics in Salesforce?
i am thankful for your valuable response.
Reply

David Liu
M A RC H 1 1 , 2 0 1 4 @ 9 :4 2 PM

Thats a lot of questions Yaniv very curious where they came from!!
Maybe some of these are good interview questions, hahaha.

http://www.sfdc99.com/beginner-tutorials/

40/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Anyway, I cant help you with all of them but the good news is you can probably
Google most of the answers. I wrote a sweet post of #4 though check it out!
http://www.sfdc99.com/2013/06/24/example-how-to-write-a-cross-object-soql-querypart-2/
David
Rep l y

Yaniv
M A RC H 1 2 , 2 0 1 4 @ 6 :3 4 A M

Hi David Liu,
Your guess is correct. I am looking for new opportunities and mentioned are some of
the Qs I faced. Sure that I will get answers from Google for all. Need your help for
below mentioned 3 questions for which i didnt find correct one.
5. How to create Wizards in Salesforce?
Per my understanding, can write VFPs that resembles Wizards in execution. But there
is no direct option in Salesforce to create Wizards. Please correct me if I am wrong.
6. What is the admin permission exist in PROFILEs to enable/disable DEBUG MODE
option?
Per my understanding, there is no option or administrative setting in PROFILE to
enable/disable the debug mode.
9. What are all the changes needed in Visualforce pages and Apex classes to convert
a web application to a mobile application?
Thanks for your valuable response.
Reply

David Liu
M A RC H 1 2 , 2 0 1 4 @ 8 :0 8 PM

Best of luck in your interviews!


5. You can use Visual Workflows without code!
https://help.salesforce.com/HTViewHelpDoc?
id=vpm_admin_flow_overview.htm&language=en_US
6. It is on the user detail page: Development Mode
http://www.sfdc99.com/beginner-tutorials/

41/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

9. Never done this before so cant give a good answer sorry!! My guess
is very little!
Rep l y

gopsal
M A RC H 6 , 2 0 1 4 @ 9 :1 8 A M

Hi David,
Currently I am working as Testing engineer. I am planning to learn salesforce development. Can you
please guide me how to start with sales force.
Please Thanks in advance.
Reply

David Liu
M A RC H 6 , 2 0 1 4 @ 9 :5 3 PM

Are my beginner tutorials insufficient for your needs? =(


http://www.sfdc99.com/beginner-tutorials/
If so, let me know where its lacking so I can write those guides!
David
Rep l y

Kenneth Ray
M A RC H 2 , 2 0 1 4 @ 9 :4 4 PM

David, I just want to say I love the site!!!! Thanks for ALL your help!!!
Reply

http://www.sfdc99.com/beginner-tutorials/

42/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
M A RC H 3 , 2 0 1 4 @ 1 0 :2 6 PM

Love you guys too!


David
Rep l y

Hamed Mohiuddin
FE B RU A RY 2 0 , 2 0 1 4 @ 1 0 :4 3 A M

Hey David,
I am functional admin trying to get into the development realm. Having a tough day at my job where I
have to
1. Hide a Contact Name custom field on opportunity object on the detail page
2. Based on the Contact name I have to create a Contact Role on the Opp marked as primary and set a
role
3. Create a contact role on opp when its created from the Contact Object
Now I know for the first one I need to create Visual force page and add to the standard opportunity
page layouts. However, I have never written a VF page before
and I need some direction in the next 2 as well.
Please help! I have started writing beginner level code (triggers) thanks to you, but I think the abov eis
way beyond my understanding right now. Please privde some direction as to where and how I should
get started.
Thanks
Best,
Hamed
Reply

David Liu
FE B RU A RY 2 0 , 2 0 1 4 @ 9 :2 9 PM

Hey Hamed,
http://www.sfdc99.com/beginner-tutorials/

43/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

This stuff sounds like it can be done without code!


1. Remove the field from the page layout
2 & 3. Only allow opps to be created from Contacts this will automatically add them
as a Contact Role on the opp as a primary contact! You can even write a trigger to
move this along further!
Hope this helps!
David
Rep l y

Jameel
FE B RU A RY 1 2 , 2 0 1 4 @ 8 :1 0 A M

Hi, I am Very new to SF I need to do automatically convert lead to opportunity. If contact is not exist
we need to create new contact, if contact is exist we need not create contact, and this lead
automatically convert into opportunity.
Please provide trigger code for this solution.
Thanks in advance.
Reply

David Liu
FE B RU A RY 1 2 , 2 0 1 4 @ 7 :0 2 PM

Check out these two links to help you out!


Lead conversion:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_convertLead.htm
Deduping:
http://www.sfdc99.com/2013/10/19/example-how-to-write-a-deduping-trigger-forleads-and-contacts/
Rep l y

http://www.sfdc99.com/beginner-tutorials/

44/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Jameel
FE B RU A RY 1 3 , 2 0 1 4 @ 4 :4 4 A M

Hi David,
I have taken below this code form net.
trigger ConvertLead on Lead (after insert, after update) {
for (Lead lead : Trigger.new) {
if (lead.isConverted == false) //to prevent recursion
{
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(lead.Id);
String oppName = lead.Name;
lc.setOpportunityName(oppName);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE
IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
}
}
}
this is converting lead to opportunity but not immediately. After adding lead this
code executed and Converted Lead page showing with contact, account and
Opportunity values. After clicking this value only this record move to opportunity.
Why we need to click, after that only record move to contact , account , opportunity. I
need auto convert.
Please advise.
Reply

David Liu
FE B RU A RY 1 4 , 2 0 1 4 @ 6 :3 5 PM

Hey Jameel,
So the Lead is actually converted immediately after you create the lead
http://www.sfdc99.com/beginner-tutorials/

45/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

whether or not you click any links after that!


What happens is that Salesforce tries to navigate to the lead after the
trigger finishes, and that goes to the page with links to the Account,
Contact, and Opportunity. This is something you cant change
unfortunately! Triggers also cannot force a user to go to a certain page
after it runs only Visualforce can do this!
So your options are to either let it be as is (lead gets converted but
landing page is not ideal), or, build a Visualforce page to redirect the
user to the Opportunity! I recommend the former option since its a lot
simpler!
David
Rep l y

Pavan
FE B RU A RY 1 1 , 2 0 1 4 @ 9 :3 8 PM

Thanx bro.. Ll try that now


Reply

Kay
FE B RU A RY 9 , 2 0 1 4 @ 5 :2 4 PM

Hi David,
Just wanted to leave a quick message of appreciation, i am also a Junior dev and still learning the
ropes, you have covered a lot of core information which is great, I have recommended this to many
colleagues and will continue to do so!
I look forward to chapter 9!
Reply

http://www.sfdc99.com/beginner-tutorials/

46/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
FE B RU A RY 1 0 , 2 0 1 4 @ 7 :0 9 PM

My pleasure Kay, thank you for commenting!!!


David
Rep l y

Pavan
FE B RU A RY 9 , 2 0 1 4 @ 4 :1 0 PM

Hello David
I just started my coding on Apex. I have a problem in accessing ProductFamily, which is a pick list from
the Visual Force Page. I have written the Custom Controller. But Still I am not able to get my
ProductFamily fields in the picklist. Its null and I am getting null pointer exception.
My COntroller is as follows
public without sharing class UserController
{
public List UserTemp = new List();
public UserController()
{
}
public List UserList
{
get
{
UserTemp = [Select Name, ProductCode,Family From Product2];
UserList = new List();
for(Product2 temp : UserTemp)
{
UserList.add(new SelectOption(temp.Family, temp.Name));
}
return UserList;
}
set;
}
}
and My Visual Force Code is as follows
http://www.sfdc99.com/beginner-tutorials/

47/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

It would be really helpful, if you could help me out please.


Thanks and Regards,
Pavan
Reply

David Liu
FE B RU A RY 1 0 , 2 0 1 4 @ 7 :1 5 PM

Heres my advice!
Try hardcoding Family values first just to see if its working at all!
If its not, you know youre not accessing the data correctly with your Visualforce.
If it is, then there is something incorrect with your SOQL query! Try doing your query
in a tool like Workbench to see the output!
Hope this helps!
David
Rep l y

Pavan
FE B RU A RY 1 1 , 2 0 1 4 @ 1 0 :5 5 A M

I tried that bro. Now using the standard controller to display the picklist values. But
after I choose a picklist, one more list should be displayed, based on the selected
value. I am not finding how to do this.
Regards,
Pavan
Reply

David Liu
FE B RU A RY 1 1 , 2 0 1 4 @ 9 :3 1 PM

http://www.sfdc99.com/beginner-tutorials/

48/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Liberal use of the rerender attribute Pavan!!


Rep l y

Pavan
FE B RU A RY 1 2 , 2 0 1 4 @ 7 :4 9 A M

Thank you so much Bro.


Regards,
Pavan

David Liu
FE B RU A RY 1 2 , 2 0 1 4 @ 7 :0 1 PM

My pleasure Pavan way to go!

Zen
JA NU A RY 3 1 , 2 0 1 4 @ 6 :3 7 A M

is there really demand for simply admin people in the market? feel like people want developers or
admins who code etc? would i be able to get a job as simply admin. i mean i can learn code later if i
want on my own time but i feel like focus on one thing at time you know?
Reply

David Liu
JA NU A RY 3 1 , 2 0 1 4 @ 8 :1 6 PM

I agree thats its best to learn the admin stuff first. You cannot be a good developer
without being very good as an admin!
Market for both right now is hot but its a little better for devs. In the end, you need
http://www.sfdc99.com/beginner-tutorials/

49/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

to choose what you enjoy the most, because youll be spending 40+ hours a week
doing it!
Rep l y

Zen
JA NU A RY 3 0 , 2 0 1 4 @ 8 :5 1 A M

Thank you for your patience and your kind and informative responses! I wish you a good 2014 my
friend!
Reply

Zen
JA NU A RY 2 9 , 2 0 1 4 @ 8 :1 9 A M

Hey!
sorry! absolute last question!
i cant seem to find the checkout enabled box for my user detail page. it told my to give manage billing
permission first and i did that at my sys admin profile but then when i wen to my user detail page the
checkout enable box is not there.
this checkout is to allow user to purchase additional license as you know.
info
i am using free developer account. license is salesforce.
thank you and sorry for the questions!
Reply

David Liu
JA NU A RY 2 9 , 2 0 1 4 @ 8 :2 7 PM

http://www.sfdc99.com/beginner-tutorials/

50/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

I believe that checkbox is only for paid Salesforce orgs =)


Rep l y

Zen
JA NU A RY 2 9 , 2 0 1 4 @ 7 :3 5 A M

last question
what is a org that you refrred to? is org the company you are hired and working with?
also with regards to code..
i barely know it or code stuff and am going fro admin right now.
Do i need sql/soql query languages for admin work or does that come later when i become a developer
etc? what is the breadth of code needed for admin work? i assumed business logic like workflow,
validation rules would be enough. i guess conditional statements like basic if then statements are all
you need. i am assuming apex library and java not really needed? i was told you need triggers along
with everything i stated.
planning on go for developer after admin so i have asked you.
Thanks again!
Sincerely,
Zen
Reply

David Liu
JA NU A RY 2 9 , 2 0 1 4 @ 8 :2 6 PM

Hey Zen,
An org is simply the Salesforce that you are logging in to =)
No need to know Apex, sql/soql, or triggers if you simply want to be an admin! Zero
code and zero code reading! 90% of people are simply admins!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

51/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Zen
JA NU A RY 2 9 , 2 0 1 4 @ 7 :3 0 A M

what exactly is a instance?


when you enable things for users you do that at the profile level and all user to that profile have those
right? you dont need to go to each user to enable that etc? it is only when you want to give some users
special access you use permissions correct and then you go to that indvidual user?
also, when you use permission do you need to first use a permission set and assign a user to that set
and add the permission or no? I also think you dont need permission set licenses for every
permission?
lastly, how do you add user and feature license s to users? do you just do that at profile level or do you
have to click on user or when you create a new user and assign that? for feature it says click users etc.
basically i am confused what to add on prole level vs go to a user specifically for?
also are feature licenses related to user licenses or a part of them or separate? I hope my query was
clear! I am studying for the company profile aspect of the admin exam.
Thank you so much!
zen
Reply

David Liu
JA NU A RY 2 9 , 2 0 1 4 @ 8 :2 5 PM

Hey Zen,
An instance is your Salesforce that your users log in to!
Profile permissions are shared across all users!
Permission sets are if you want to assign a permission to just one person!
Feature licenses are per user!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

52/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

zen
JA NU A RY 2 8 , 2 0 1 4 @ 2 :4 2 PM

hello
Reply

David Liu
JA NU A RY 2 8 , 2 0 1 4 @ 8 :2 5 PM

Hi =) I get a lot of spam comments so I need to approve all comments before they
show up! I promise Im reading!
Rep l y

zen
JA NU A RY 2 8 , 2 0 1 4 @ 8 :2 2 A M

Hey i just wanted to clarify some terms


what is a
org?
environment?
instance?
sandbox?
production
deployment?
i have a free developer environment account from developer force and that is the only thing i know.
can you put these terms in your own words and relate them to mu free account so i can understand?
thanks =)
also do admins need lot of sql stuff or just apex triggers?
Reply

http://www.sfdc99.com/beginner-tutorials/

53/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JA NU A RY 2 8 , 2 0 1 4 @ 8 :2 4 PM

Org your Salesforce instance!


Environment Same as org!
Instance Same as org!
Sandbox a type of org that is a copy of your normal instance but has no records.
Good for practicing!
Production your normal Salesforce org that your users are using!
Deployment migrating things from sandbox to production!
SQL/SOQL is critical to writing triggers, almost every trigger will use it!
Rep l y

piyush
JA NU A RY 2 5 , 2 0 1 4 @ 5 :0 6 A M

Dear David,
I need to create the following task only with trigger:
1. There is a Custom Object A with two child objects A1 and A2.
2. Each child objects has a mutiselect picklist field.
3. A1 has picklist values like food, beverage and whereas A2 has
picklist values like food, games.
Task: Whenever we select all picklist values of Child objects A1 and A2 ,the parent object A must
populate all value of child records and it should be only unique values of child picklist value, for
example, if I select the all the value of multiselect picklist of both child objects A1 and A2 then A parent
object must populate food, beverage and games only not food twice.
I need this task to be completed only with trigger code, please provide the solution for the problem.
I
Reply

David Liu
JA NU A RY 2 5 , 2 0 1 4 @ 1 1 :4 5 A M

http://www.sfdc99.com/beginner-tutorials/

54/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hey Piyush!
Heres how to tackle the problem:
1. Create a trigger on the child object
2. In the trigger, traverse to the parent object and query all child objects
3. Loop through the child objects and add the picklist values to a Set (to prevent
duplicates)
4. Update the master picklist on the parent object
Best of luck =)
David
Rep l y

piyush
JA NU A RY 2 7 , 2 0 1 4 @ 1 0 :1 1 A M

Dear david,
Can you please make me understand through coding, it will
be really a great help ,I am totally new to triggers.
Thanks
Regards
Piyush
Reply

David Liu
JA NU A RY 2 7 , 2 0 1 4 @ 9 :1 0 PM

Hey Piyush,
My best suggestion is to get this Java book to ramp up quickly:
http://www.sfdc99.com/2013/05/20/the-best-way-to-quickly-learn-howto-code-in-salesforce/
Then go through each chapter here one by one you definitely have
the tools to do this once you get up to Chapter 5!
http://www.sfdc99.com/beginner-tutorials/
When youre ready, post your code and Ill do my best to help debug!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

55/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

sfdc novice
JA NU A RY 1 6 , 2 0 1 4 @ 1 1 :5 1 PM

Congrats David on you Becoming an MVP.Your contribution to the


community is amazing and i wish you all success in your future
endeavours.
Reply

David Liu
JA NU A RY 1 6 , 2 0 1 4 @ 1 1 :5 2 PM

Thank you so much =*) This means a lot to me!


Rep l y

Anonymous
JA NU A RY 1 5 , 2 0 1 4 @ 6 :0 7 A M

Hi David,
Can you please explain the concept of Batch Apex with a simple example.
Regards,
sfdc novice
Reply

David Liu
JA NU A RY 1 5 , 2 0 1 4 @ 8 :5 8 A M

Batch Apex lets you run and schedule huge coding jobs!
http://www.sfdc99.com/beginner-tutorials/

56/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Youll want to use batch apex if:


- You need to schedule something to run at a specific time on a repeating schedule
- Governor limits prevent you from doing the mass calculations you need in a trigger
I used this to learn how to do batch apex =) Its pretty good!
http://developer.force.com/cookbook/recipe/using-batch-apex-to-reassign-accountowners
Ill have a series on how to do batch and scheduled Apex in chapter 9!
David
Rep l y

prasanth
JA NU A RY 1 3 , 2 0 1 4 @ 6 :0 5 PM

Nice post and it made me confident on salesforce by reading your all articles
Reply

David Liu
JA NU A RY 1 3 , 2 0 1 4 @ 8 :0 7 PM

Good job Prasanth, hope you continue to have a great Salesforce career!
Rep l y

Sanjay Gupta
JA NU A RY 8 , 2 0 1 4 @ 8 :4 5 PM

Thanks a lot for the material you provided bro.Yesterday,i cleared a interview for the tier 2 developer
support for salesforce,now i will appear for next round by 1 feb in which they will ask me about
force.com platform and visual force pages and coding part.if i will find difficulty while studying that in
next 15 days,i ll surely ask for your help.thanks a ton..God bless you.
Reply

http://www.sfdc99.com/beginner-tutorials/

57/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JA NU A RY 8 , 2 0 1 4 @ 9 :0 5 PM

Woohoo!!! Congrats on passing the interview!!!


Best of luck on your next round if you need any advice, you know who to talk to!
David
Rep l y

sss
JA NU A RY 8 , 2 0 1 4 @ 5 :5 0 PM

Hi David,
I have a merchandise object and line item objectwhen I place an order via a line item record, the
merchandise inventory should get reduced accordingly. Can you help with this.
Thanks
sss
Reply

David Liu
JA NU A RY 8 , 2 0 1 4 @ 8 :5 1 PM

Hey sss =)
Youll need a trigger for this!
First, your trigger needs to detect when an order is placed (hard part):
http://blog.jonathanbroquist.com/using-trigger-old-trigger-new-to-detect-whenfield-values-change/
Then, youll need to do a SOQL query for the particular Merchandise object and
reduce its inventory (easy part):
This tutorial does something similar: http://www.sfdc99.com/beginnertutorials/#soqlTrigger

http://www.sfdc99.com/beginner-tutorials/

58/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hope this helps, let me know if you need more guidance!


David
Rep l y

Sanjay Gupta
JA NU A RY 7 , 2 0 1 4 @ 7 :2 4 PM

Hi David,
Can you recommend me some material for administrator part.i am working on sfdc for last 1 month.i
am developing my app. in my developer org. for a school.i have used custom objects,custom
tabs,custom fields,designed profiles and roles as well.used master-detail and look up as well.its really
interesting,i think atleast for 6 months ,i should focus on admin part bcoz there are lots and lots of
things such as workflow,approval process,junction obect,time based work flow,much more to
undrstand and then i should jump into developer part.
1.So ,can you suggest me some material for admin part.
2.Can you explain me what is Record Type.
Reply

David Liu
JA NU A RY 7 , 2 0 1 4 @ 7 :3 1 PM

This ones by far the best tutorial Ive seen for the admin side of things! It covers
everything youd ever want to know!
http://bit.ly/1bge5A3
Additionally, heres a free course thatll help you get started on the admin side:
https://www.udacity.com/course/ud162
Think of record types as categories. For example, you might have a record type
category for Public accounts and Private accounts. The biggest advantage of
record types is that you can show different fields for each record type. For example,
Public accounts could have a field for Stock Price, while Private accounts
wouldnt show that field.
Hope this helps!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

59/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Anonymous
JA NU A RY 6 , 2 0 1 4 @ 5 :1 4 A M

Hi David,
Can you please explain the concept of email services with a simple example.
Regards,
sfdc novice
Reply

David Liu
JA NU A RY 6 , 2 0 1 4 @ 5 :3 2 PM

No worries SFDC novice, Ive added this to the tutorial to do list!


In the meantime, you can check this page out for an example:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_forcecom_email_outbound.htm
David
Rep l y

Sanjay Gupta
JA NU A RY 5 , 2 0 1 4 @ 6 :4 5 A M

Hi David,
Can you please explain me the difference with real world example for Workflow and Approval Process.
for e.g student(object) issuing a book from library(object) with date of issue and date of return fields. if
student returns a book after 2 days ,he should be imposed a fine of $1 every day till he returns.So,will
the workflow work for it or approval.
can you give me some real world example.
Reply

http://www.sfdc99.com/beginner-tutorials/

60/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
JA NU A RY 5 , 2 0 1 4 @ 1 1 :0 5 A M

Heres a video that covers it in depth:


http://www.salesforce.com/_app/video/workflow/help/create_workflow_rule.jsp
For your particular requirement, that wont be possible with a workflow. Workflows
are very simple If this, then that and dont have access to other record values. So
youd need code in your book example.
Approvals wouldnt really be used anywhere for your requirement!
Rep l y

Piyush Gupta
JA NU A RY 4 , 2 0 1 4 @ 6 :4 0 A M

Hii David ,
I created four custom objects ,A which is a a parent of B and B which is a parent of C and C is a parent
of D. Each custom objects has amount field with currency data type.The thing is this ,I need to create
this task only withTrigger in such a way so that it will calculate
the amount like Bs custom field i.e A+B will show addition of amount of both A and B . C will also display
addition of amount of B and C same thing with D .Please provide me how to accomplish this task.
Reply

David Liu
JA NU A RY 4 , 2 0 1 4 @ 5 :3 4 PM

Hey Piyush,
Since this is possible without writing code, Id recommend that method first.
Whenever you have master-detail relationships, you can sum the values of your
children using roll-up summaries:
https://help.salesforce.com/HTViewHelpDoc?
id=fields_about_roll_up_summary_fields.htm&language=en_US

http://www.sfdc99.com/beginner-tutorials/

61/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

So lets say A has three child objects of B, each with amount 10, 20, and 30. You can
create a roll-up summary on A that sums up all the amounts of the children Bs, in
this case, that would be 10 + 20 + 30 = 60. If you need to add As amount (lets say its
50), create a formula that adds the two together 50 + 60 = 110.
Hope this helps =) Let me know how it goes!
David
Rep l y

Sunil
JA NU A RY 4 , 2 0 1 4 @ 2 :3 0 A M

David, could you explain the get;set . If you have already done in the past direct me on page.
public List accounts {get;set;}
Thanks
Reply

David Liu
JA NU A RY 4 , 2 0 1 4 @ 5 :3 0 PM

Youll mostly use {get; set;} when creating Visualforce pages and controllers. Outside
of that they are not really necessary unless youre building a huge app!
Adding {get; set;} after a variable automatically creates two methods for you that
you can use. For example, with a name variable
String name {get; set;}
// These two methods are automatically created in the background
public String getName() {
return name;
}
public void setName(String n) {
name = n;
}
So instead of editing the variable name directly, you use these two methods
instead. Here are many documented reasons why we use these methods:
http://stackoverflow.com/questions/1568091/why-use-getters-and-setters

http://www.sfdc99.com/beginner-tutorials/

62/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hope this helps!


David
Rep l y

Anonymous
D E C E M B E R 2 8 , 2 0 1 3 @ 8 :3 7 A M

Way you make concept easy its really terrafic!!


Reply

sfdc novice
D E C E M B E R 2 7 , 2 0 1 3 @ 7 :1 4 A M

Hi David,
Can you plz explain the concept of recursive triggers with a simple example
Regards,
sfdc novice
Reply

David Liu
D E C E M B E R 2 7 , 2 0 1 3 @ 9 :2 7 A M

Heres a basic example:


Lets say you have a trigger that creates an opportunity every time a case is created.
Then, you have another trigger that creates a case every time an opportunity is
created.
What will happen is that each trigger will be fired after the other with no possible
end! Thus, recursion =)
http://www.sfdc99.com/beginner-tutorials/

63/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Salesforce will detect that recursion is happening and end it after a while. This is
why Salesforce has governor limits!
David
Rep l y

Anonymous
D E C E M B E R 3 0 , 2 0 1 3 @ 5 :3 4 A M

Thnx a lot David.


Regards,
sfdc novice
Reply

Raj
D E C E M B E R 2 7 , 2 0 1 3 @ 4 :4 4 A M

Hi David,
I want to make the below query dynamic, In below code I am using hard-coded values (integer
i=1;i<=5;i++)
I know I can use size() method but in this case number depends on fields on Address object.
Currently in Address object there are 5 Fields so I have taken i<=5. I want in future if someone adds few
more fields to that object we should not change the code. Plz help.
public with sharing class abc123dynamic {
public list addr = new list();
public string initialquery=select Name,;
public string middlequery=;
public string finalquery= from Addrress__c;
public string strq=;
public list getReccords() {
for(integer i=1;i<=5;i++)
{
if(i<=4)
{
http://www.sfdc99.com/beginner-tutorials/

64/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

middlequery += 'Address'+i+'__c'+',';
}
else
{
middlequery += 'Address'+i+'__c';
}
}
strq = strq+initialquery+middlequery+finalquery;
addr=database.query(strq);
return addr;
}
}
Reply

David Liu
D E C E M B E R 2 7 , 2 0 1 3 @ 9 :2 8 A M

You can dynamically query the number of fields on on object =)


Start here:
http://bit.ly/1fvR2Tj
David
Rep l y

Liz K
D E C E M B E R 2 6 , 2 0 1 3 @ 6 :3 1 PM

Eric thanks so much for this! Reading about your experiences makes me realize that other nontechies are not alone in trying to figure this stuff out, and theres hope, too!
Question on guidance When would you recommend that people go through the links on this page (in
order), versus starting off with 1 blog post and clicking the next link at the bottom of the post?
Sometimes those go to additional articles that arent necessarily referenced on this page.
Reply

http://www.sfdc99.com/beginner-tutorials/

65/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
D E C E M B E R 2 6 , 2 0 1 3 @ 8 :1 6 PM

Definitely go in order on this page! If its not linked on this page, its probably not
that important or its covered again elsewhere!
Rep l y

ashish
D E C E M B E R 1 8 , 2 0 1 3 @ 7 :5 2 PM

Hi David, you have done a wonderful job and I appreciate your efforts you put into to explain things in
a very way.Best thing about you you respond to many of the mails and comments..please keep up the
spirit
I would request you to please explain collections in a detail ways , as collections play a very important
role. for example map collection requires lot of visualization to actually implement it.
Would appreciate if you explain collections in very details
Thanks Ashish
Reply

David Liu
D E C E M B E R 1 8 , 2 0 1 3 @ 8 :0 2 PM

Ashish, I have a lot of fun doing it hahaha !


Maps are coming up in this chapter, promise! They are the #1 tool for getting
around governor limits!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

66/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

sree
D E C E M B E R 1 6 , 2 0 1 3 @ 3 :2 4 A M

Hi,
this is my trigger code..how test this code i m trying but it;s not working they show error
@IsTest
public class TestDisplayerrormsg
{
static testMethod void insertmarkes()
{
Student__c std =new Student__c();
std.Student_Name__c=sree;
std.Name=sre; //roll number master detail ship filed
insert std;
Markes__c Mar = New Markes__c();
Mar.Roll_Number__c= ; //master detail relation ship with student
Mar.Name=jan;
Mar.sub_1__c=19;
Mar.sub_2__c=18;
Mar.sub_3__c=17;
Mar.sub_4__c=19;
Mar.sub_5__c=18;
Mar.sub_6__c=17;
Mar.Esub_1__c=78;
Mar.Esub_2__c=79;
Mar.Esub_3__c=78;
Mar.Esub_4__c=76;
Mar.Esub_5__c=78;
Mar.Esub_6__c=79;
insert mar;
}
}
Reply

David Liu
D E C E M B E R 1 7 , 2 0 1 3 @ 7 :4 0 PM

Hey Sree,
Happy to help! I will also need to see your trigger code to see why it is not working!
David
http://www.sfdc99.com/beginner-tutorials/

67/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Rep l y

sudha
D E C E M B E R 1 6 , 2 0 1 3 @ 2 :4 6 A M

Not able to understand the topics like emailservices. Expecting you to have a lesson on that.
Thank you very much
Reply

Mayank Jain
D E C E M B E R 1 1 , 2 0 1 3 @ 1 1 :5 7 PM

Hi David,
I want to add two case fields in my custom VF page where i used Standard Controller= Account.
Is their any way to add case field in VF page using statndard controller as Account.
Below is my code.
Can you help me on this?As i am new in apex code.
Reply

David Liu
D E C E M B E R 1 2 , 2 0 1 3 @ 7 :3 4 PM

Yes! Take a look at Controller Extensions!


http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm
Rep l y

Mayank Jain
http://www.sfdc99.com/beginner-tutorials/

68/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


M A RC H 1 3 , 2 0 1 4 @ 1 :2 8 A M

Thanks a Lot!!!
Reply

Avshek
NOVE M B E R 2 5 , 2 0 1 3 @ 3 :1 6 A M

Hi David,
Great job !!! You are the best !!
I was reading our course and it was amazing. All my SFDC concepts were getting cyrstal clear.
But, I could not access after Chapter 5 Point 2.
Is it yet to be published or may be I am havng some browser issue ?
If its yet to published. Please let me know. I would be eagerly waiting for your update.
Thanks a lot man for helping us out with Apex coding. You are a genius.
Regards,
Avishek
Reply

David Liu
NOVE M B E R 2 5 , 2 0 1 3 @ 6 :3 6 PM

Woot woot!
Ive planned out 10+ chapters but only written to 5.2 as of today!
You can expect at least 1 2 posts a week, especially during the holiday season!
Also, planning to put a fun little challenge that will let readers join the Sfdc99 Hall of
Fame!
Lots of fun stuff coming!
David
http://www.sfdc99.com/beginner-tutorials/

69/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Rep l y

O
NOVE M B E R 2 4 , 2 0 1 3 @ 6 :4 9 PM

Hi David,
I want to start off by saying a big THANK YOU. The information provided in this site is clear and easy
to understand. I found your website on LinkedIn from an answer to a question someone asked on how
beginners could learn Apex. I actually have practiced all the workbooks and materials everyone
recommends for beginners but did not get a solid grasp of Apex language until I started going through
the lessons on this site. You nailed it for me with this site. The lessons on this site connected the dots
for me.
I spent over five hours on this site yesterday. I enjoyed the humor in your teaching style and love the
practical examples. I found your words of encouragement and tips very helpful too. I have now
completed all the lessons and I am hungry for more lessons from you. I have already sent your website
info to new folks in SF that I know.
I just thought to leave a comment to encourage your desire to help others and find out what I could do
to show some more appreciation. I honestly feel a Thank You is just not enough for this brilliant work.
Well done.
I appreciate!
Reply

David Liu
NOVE M B E R 2 4 , 2 0 1 3 @ 8 :1 8 PM

Very honored to be able to help you learn!


Your comment is inspiring to say the least! Love is what keeps me going here =)
Lots more content to come, I promise!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

70/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Manish
NOVE M B E R 2 0 , 2 0 1 3 @ 6 :5 7 A M

Thanks a lot David for helping me understand the triggers,


your website is truely helpful for a beginner like me, if possible could you please add some simple Apex
and Visualforce codes(apart from triggers) which will further help in understanding Apex and VF code.
Reply

David Liu
NOVE M B E R 2 0 , 2 0 1 3 @ 7 :2 5 A M

Thank you Manish! There will definitely be lessons in VF and the non-trigger portions
of Apex! Id like to take it one step further even and talk about object oriented
theory too!
David
Rep l y

neha
NOVE M B E R 1 9 , 2 0 1 3 @ 1 0 :0 0 PM

looking forward to see next posts Thanks for ur immense help I was searching for all the sitesvery
madly to learn the apex and got struck here with ur amazing site.. Its seriously soo helpful for me
Reply

David Liu
NOVE M B E R 1 9 , 2 0 1 3 @ 1 0 :4 2 PM

Hahaha, no problem, tell your friends!


Rep l y

http://www.sfdc99.com/beginner-tutorials/

71/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

semsem1983
NOVE M B E R 1 8 , 2 0 1 3 @ 6 :2 0 A M

Hey David,
Im planning to take DEV 401 next month. could you please share some materials and suggestions?
Thank you!
Reply

David Liu
NOVE M B E R 1 8 , 2 0 1 3 @ 1 0 :1 2 PM

Hey Semsem,
First off, remember that the DEV401 exam has no code in it. Absolutely zero! Its
actually very similar to ADM201 or ADM211.
There are two sites I highly recommend for passing DEV401:
1. Sample Recruiting App: this is good because it covers all the major features of
Salesforce (workflows, validation rules, custom objects)
http://bit.ly/1bge5A3
2. Quizlet: Look for DEV401 flashcards, they are very helpful in letting you know what
you need to study for!
http://quizlet.com/20548250/salesforce-dev-401-exam-study-guide-courtesy-peterbosch-flash-cards/
I passed the exam on my first try mainly using the above two resources, so you can
do it too!
David
Rep l y

Ishan Kashyap
NOVE M B E R 1 7 , 2 0 1 3 @ 8 :2 0 A M

Helllo David,
I am following ur video tutorials..They are superb for learning and ur videos make the coding thing easy
on salesforce..please upload more tutorials.
http://www.sfdc99.com/beginner-tutorials/

72/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Thanks
Reply

Saif
NOVE M B E R 1 3 , 2 0 1 3 @ 9 :2 4 PM

Hi David. Can you help me with this ? Ive tried searching a lot for this but so far all my efforts are in
vain.
I need to track Days since last Event on every Account record. I need to prep a report for my orgs top
mgmt. The default Days since last Activity wont help me.
If you have come across any similar article which can help me on this, Please guide me. Thanks.
And Yeah, Im a newbie. Ive just started with Head First Java and loving it.
Reply

David Liu
NOVE M B E R 1 3 , 2 0 1 3 @ 9 :4 2 PM

Hey Saif,
I love code, but you can do this one without it!
If youre familiar with Roll-Up Summary fields, you can simply create one that gets
the MAX date of associated Event records. Youd even be able to add criteria to
your field to only get the MAX of certain Events.
Roll-Up Summaries arent available by default with Accounts and Events (since its
not technically a master-detail relationship) but you can simply install this very
popular app to have the same functionality!
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI
Then, simply have a formula field that calculates the number of days between
TODAY() and your roll-up field.
Hope this helps!!
David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

73/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Saif
NOVE M B E R 1 4 , 2 0 1 3 @ 1 2 :4 0 A M

Hi David.
Thanks for the prompt reply. However Im unable to get it to work.
I installed the App and followed the step by step procedure. However the field on the
Account object Date of Last Event isnt updating for some reason. I used the
MAX(Completed Date) field of Event with a filter stating: Event Status = Completed..
Im pretty sure I did it properly. :(
Reply

David Liu
NOVE M B E R 1 4 , 2 0 1 3 @ 8 :3 3 PM

Hey Saif,
Try doing it on a brand new set of accounts and events to see what
happens! I suspect that it doesnt work on older records unless you
trigger it in a certain way!
If all else fails, give their support a call!
1.847.574.5742
Finally, if all else fails, lets code!
David
Rep l y

semsem1983
NOVE M B E R 1 2 , 2 0 1 3 @ 1 0 :4 1 A M

Keep up the amazing work David. Chapter 5 and 6 are very important to me. cant wait :)
Reply

http://www.sfdc99.com/beginner-tutorials/

74/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
NOVE M B E R 1 2 , 2 0 1 3 @ 6 :4 6 PM

Thanks Semsem I cant wait too!!!!!


Rep l y

Srikanth
NOVE M B E R 1 0 , 2 0 1 3 @ 1 0 :5 4 PM

Hi David,
U r Just Amazing..plz Keep Posting..
T
Reply

David Bruce
OC T OB E R 2 9 , 2 0 1 3 @ 1 0 :4 0 PM

Hi David,
Thanks for making this site and being so helpful in the support forum. I found your link there and came
here and just want to express my thanks. Ive been looking for a way to look down so I can write a
trigger to update the children of a self-join when certain parents fields are updated. Most other code I
found was way over my head. Your clear presentation made it easy to understand what I need to do.
Also, your humor is greatly appreciated, too. That strawberry smoothy was delicious!
Gratefully,
-another David
Reply

http://www.sfdc99.com/beginner-tutorials/

75/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

David Liu
OC T OB E R 2 9 , 2 0 1 3 @ 1 0 :5 9 PM

Glad you enjoy the site David =)


More posts coming this weekend!
David
Rep l y

Santhosh
OC T OB E R 1 6 , 2 0 1 3 @ 8 :4 0 A M

Thanks for the reply David,


Im exactly asking about the functionality and link between Salesforce Standard Objects like
Opportunity, Products, Opportunity line items, Quotes, Forecasting like things.
Reply

David Liu
OC T OB E R 1 6 , 2 0 1 3 @ 1 0 :3 2 PM

Hey Santhosh,
Thanks for the inspiration! Im going to have a future chapter on data models and
the different relationships between objects. For now though I recommend looking at
Salesforce standard documentation for this kind of stuff.
David
Rep l y

Santhosh
OC T OB E R 1 5 , 2 0 1 3 @ 4 :4 1 A M

http://www.sfdc99.com/beginner-tutorials/

76/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hi David,
Its a great work. I want to know the salesforce standard functionality.
If possible can you please post the content on it.
Thanks,
Santhosh
Reply

David Liu
OC T OB E R 1 6 , 2 0 1 3 @ 1 :0 7 A M

Hey Santhosh,
Is there any particular aspect of Salesforce standard functionality youre looking to
learn? Happy to educate!
David
Rep l y

Chris
OC T OB E R 1 3 , 2 0 1 3 @ 9 :1 4 A M

Really loving this series and was delighted to see TWO in my mailbox!
Eagerly looking forward to more :)
Reply

David Liu
OC T OB E R 1 3 , 2 0 1 3 @ 1 2 :2 4 PM

Youve inspired me to write more, Chris =)


David
Rep l y

http://www.sfdc99.com/beginner-tutorials/

77/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

ashish
OC T OB E R 7 , 2 0 1 3 @ 1 1 :5 3 PM

I am loving it ..please carry on.. great work dont stop..woould appreciate


Reply

David Liu
OC T OB E R 8 , 2 0 1 3 @ 1 :1 9 A M

More coming this week Ashish! Thanks for visiting my site!


Rep l y

Ales
OC T OB E R 7 , 2 0 1 3 @ 1 :2 2 A M

David,
I posted some code to copy the task objects activitydate on the success forum and you responded
overnight, and I followed you to here. You are God-sent and may all the good that you are doing here
on your site come back to you a million times that is my blessing to you!
I clicked on your link to get the Java book you suggested. I hope you are being paid by Amazon for it.
I cant wait for your next post looking forward to it! Please keep doing what you are doing youre
amazing!!!
Reply

David Liu
OC T OB E R 8 , 2 0 1 3 @ 1 :2 0 A M

http://www.sfdc99.com/beginner-tutorials/

78/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Ales, your comment made my year!


More than happy to help with any coding questions you have, you know where to
find me!
In the meantime, Ill pump out more content so you can get rolling! Follow me on
twitter for updates to new posts!
David
Rep l y

Jeet
OC T OB E R 3 , 2 0 1 3 @ 2 :2 7 A M

Hi David,
Hope you are doing well!! congratulations for this amazing and very helpful website.. i am new to this
platform, i found your website, and i started studying but unfortunately after Chapter 3-3rd point
onwards the hyperlink just disabled and i am not able to view further chapters, unable to proceed with
the course..
Could you please check the pages and do the needful..
Thanks once again, waiting for your kind reply
Thanks,
Jeet
Reply

David Liu
OC T OB E R 3 , 2 0 1 3 @ 6 :5 5 PM

Hey Jeet,
Ive planned out many chapters but Im still working on the posts! You can generally
expect 1 post per week nowadays =)
You can find me often nowadays on the Salesforce Success community helping users
out with their business problems!
Let me know if theres anything in particular youd like to learn!
David
http://www.sfdc99.com/beginner-tutorials/

79/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Rep l y

Jeet
OC T OB E R 4 , 2 0 1 3 @ 2 :1 5 A M

Hi David,
Thanks a lot for your reply i am new to this platform and i dont have coding
background.. and would like to learn Apex, the way u explained Triggers and SOQL
was very nice.. can u please suggest me how to go about it??
waiting for your kind reply
Thanks,
Jeet
Reply

David Liu
OC T OB E R 4 , 2 0 1 3 @ 9 :5 9 PM

Hey Jeet,
Highly highly recommend learning the fundamentals of Java from this
book:
http://www.sfdc99.com/2013/05/20/the-best-way-to-quickly-learn-howto-code-in-salesforce/
You dont even need to get more than halfway through it!
Ill be posting once a week stay tuned!
David
Rep l y

Jeet
OC T OB E R 1 4 , 2 0 1 3 @ 2 :3 0 A M

http://www.sfdc99.com/beginner-tutorials/

80/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Hi David,
Thanks once again for your reply and thank you so much for posting the
3rd chapter.. i was waiting to learn from your website.. also as you
suggested will go through that link to learn Java Concepts.. Thanks once
again.. keep up the good work..
God Bless!!!
Thanks,
Jeet

David Liu
OC T OB E R 1 4 , 2 0 1 3 @ 6 :4 0 PM

My pleasure Jeet, happy to help! David

Chris
OC T OB E R 1 , 2 0 1 3 @ 3 :3 8 PM

LOVE IT! Really looking forward to reading more. I will keep checking in.
Reply

anand
S E PT E M B E R 1 6 , 2 0 1 3 @ 2 :4 1 PM

Hi David Liu,
i am anand myself, i greatly appreciate your work here. your website is awesome for salesforce.
i would like to know some details, please guide me.
1. i am having JAVA/j2EE background, now i am interested in Salesforce, so is the programming in
salesforce same like java..?
2. how long will it take to learn salesforce from scratch..? is apex and visual force are tough to code
and learn..?
i am thankful for your valuable response. cheers David.
http://www.sfdc99.com/beginner-tutorials/

81/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


Reply

David Liu
S E PT E M B E R 1 6 , 2 0 1 3 @ 8 :2 7 PM

Hey Anand,
The programming in Salesforce is very similar to Java! You have a huge head start
here.
The biggest is that Salesforce has governor limits, which you will have to work
around. For example, you can only query 50000 records in a single execution in
Apex. More info here:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
Apex and Visualforce will be a piece of cake for you to learn! Youll be pleasantly
surprised how easy they are to use compared to a Java EE background =)
The hardest part (if you havent already learned this) is to get used to the non-code
aspects of Salesforce. For example, permissions, sharing rules, when to use record
types, object relationships, etc. You absolutely cannot be a good Salesforce
developer unless you have a very strong grasp of what you can do without code
first.
Hope this helps, and Im glad you enjoy my site!
David
Rep l y

Saif
A U G U S T 3 0 , 2 0 1 3 @ 5 :1 0 A M

Hi David. I want to thank you for sharing this info which is very easy to pick up for a beginner like me. I
have just started my career on this platform as a business analyst after my MBA and am planning to
get certified as an admin in near future.I find your website very useful. I will be waiting for more articles
like these. Thank You.
Reply

http://www.sfdc99.com/beginner-tutorials/

82/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

Jeny
A U G U S T 2 8 , 2 0 1 3 @ 1 1 :5 2 PM

Please keep writing!!!


Reply

catherine
JU LY 1 7 , 2 0 1 3 @ 1 0 :3 3 PM

Hi, Im a beginner in apex coding. will you help me create a test class for this. I do not have DML. my
class do is just searching existing accounts.
Heres my apex controller:
public with sharing class autoAccountSearchController {
public String strDebug1 {get;set;}
public List accounts {get;set;}
public autoAccountSearchController()
{
accounts = new List();
Account a = [select Id, Name, OwnerId, Site from Account limit 1];
}
public PageReference populateAccounts()
{
accounts = [select Id, Name, OwnerId, Site from Account where Name like :(strDebug1 + '%')];
return null;
}
}
thank you.
cat
Reply

David Liu
http://www.sfdc99.com/beginner-tutorials/

83/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%


JU LY 1 8 , 2 0 1 3 @ 8 :2 7 PM

Hey Catherine,
Im so happy youre learning Apex that I started writing this as soon as I got home!
This test class will cover your code 100%. Make sure to read the comments theyll
help you understand what is going on.
@isTest
public class TestAutoAccountSearchController {
public static testMethod void testAutoAccountSearchController () {
// This creates an account for testing
Account a = new Account();
a.Name = Catherine;
insert a;
// This creates your controller
AutoAccountSearchController controller = new AutoAccountSearchController();
// This sets the search parameter to the account we just created
controller.strDebug1 = a.Name;
// This does the controllers search
controller.populateAccounts();
// This just makes sure everything worked
System.assertEquals(controller.accounts.size(), 1);
}
}
Rep l y

Leave a Reply
Enter your comment here...

http://www.sfdc99.com/beginner-tutorials/

84/85

6/15/2014

Beginner Tutorials Salesforce coding lessons for the 99%

T HE M E : S I M PLE S T Y LE BY FI M PLY

http://www.sfdc99.com/beginner-tutorials/

85/85

You might also like