Description:
BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginners G ide !or Sales"orce. The doc ment !oc ses on writing #pe$ code. %oin o r pro!essional training program and learn !rom e$perts.
History:
Version Description Change 0.1 Initial Draft 0.1 &e'ie()1 Author Chandra Prakash har!a A!it har!a Publish Date "th #uly $01% "th #uly $01%
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 1
Contents
Apex classes in SalesForce..............................................................................................................3 How to Add an Apex Class:............................................................................................................ 3 Apex Triggers in SalesForce..............................................................................................................5 Triggers:..................................................................................................................................... 5 How to write Trigger in SalesForce.com :...................................................................................6 How Do Vis alForce !ages Compare to S"Controls#........................................................................$ Creating a Vis alForce Component...................................................................................................$ %&at are C stom Components :.................................................................................................$ 'sing C stom Components in a Vis alForce !age:...................................................................$ How to De(ining C stom Components :....................................................................................1) %&at is Vis alForce..................................................................................................................... 1) %&* se Vis alForce :.............................................................................................................. 11 How To Create Vis alForce !age ...........................................................................................11 ................................................................................................................................................ 13 'sing t&e Vis alForce Component +i,rar* .....................................................................................13 -.erriding an /xisting !age wit& a Vis alForce !age.....................................................................10 1edirecting to a Standard -,2ect +ist !age.....................................................................................16 'sing 3np t Components in a !age.................................................................................................14
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 5
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 3
For create new Apex code clic; on ?ew , tton . Clic; on "ew , tton8 A(ter t&at open new we, page on t&is page Apex Code editor is a.aila,le. *o can see ,elow. %rite &ere Apex Class a(ter t&en clic; on Sa!e , tton.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 0
Schedule Apex : Sc&ed le an Apex class t&at implements t&e FSc&ed la,leF inter(ace to ,e
a tomaticall* exec ted on a wee;l* or mont&l* inter.al. Clic; on Schedule Apex , tton.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 5
&rigger Context (aria'les : (aria'le is3nsert is'pdate is/xec ting isDelete isBe(ore isA(ter is'ndelete )sage 1et rns tr e i( t&is trigger was (ired d e to an insert operation8 (rom t&e SalesForces ser inter(ace8 Apex8 or t&e A!3. 1et rns tr e i( t&is trigger was (ired d e to an pdate operation8 (rom t&e SalesForce ser inter(ace8 Apex8 or t&e A!3. 1et rns tr e i( t&e c rrent context (or t&e Apex code is a trigger8 not a Vis alForce page8 a %e, ser.ice8 or an exec teanon*mo s79 A!3 call. 1et rns tr e i( t&is trigger was (ired d e to an delete operation8 (rom t&e SalesForce ser inter(ace8 Apex8 or t&e A!3. 1et rns tr e i( t&is trigger was (ired ,e(ore an* record was sa.ed. 1et rns tr e i( t&is trigger was (ired a(ter all records were sa.ed. 1et rns tr e i( t&is trigger was (ired a(ter a record is reco.ered (rom t&e 1ec*cle Bin 7t&at is8 a(ter an ndelete operation (rom t&e SalesForce ser inter(ace8 Apex8 or t&e A!3.9 1et rns a list o( t&e new .ersions o( t&e s-,2ect records. A map o( 3Ds to t&e new .ersions o( t&e s-,2ect records. 1et rns a list o( t&e old .ersions o( t&e s-,2ect records. A map o( 3Ds to t&e old .ersions o( t&e s-,2ect records. T&e total n m,er o( records in a trigger in.ocation8 ,ot& old and new.
A(ter t&at open pop p window in t&is window8 %rite Trigger name and select -,2ect class 7w&ic& *o need to ,ind wit& trigger9 t&en clic; on s ,mit , tton. T&en *o can see new page (or write new trigger.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 6
A(ter %rite trigger 8 go to File men and clic; on Sa!e see ,elow . also *o se C&%$ + S ,* sing ;e*,oard. "ote : For nderstanding Apex Classes or Apex Trigger *o can see &ere. /xample 8 see ,elow .
,xample : %rite apex code (or a tomaticall* increasing 5H on t&e s ,mit (ees (or e.er* st dent. Step - : Create an* c stom o,2ect ta,. For /x : College *o can see ,elow.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 4
Step . : A(ter t&en go to adding Apex code8 Setup D De!eloper D Apex classes, clic; on "ew , tton. t&en write &ere Apex code.
Step / : A(ter write Apex classes 8 %rite Apex Trigger Clic; on Apex &rigger (or write Apex Trigger.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page I
JAapex:pageD
Step - : /nter +a,el ?ame t&en write Vis alForce Component a(ter t&en clic; on Sa!e , tton.
Step . : A(ter t&at create new Vis alForce page and write &ere some cod *o can see ,elow.
#hat is (isualForce
Vis alForce is (ramewor; t&at allows de.elopers to , ild re(ined8 c stom ser inter(aces t&at can ,e &osted nati.el* on t&e Force.com plat(orm. T&e Vis alForce (ramewor; incl des a tag",ased mar; p lang age8 similar to HTG+. 3n Vis alForce page *o can se &tml code8 Oa.aScript8 CSS8 A2ax8 Fles&. www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 1)
De.elopers can se Vis alForce to create a Vis alForce page de(inition. A page de(inition consists o( two primar* elements: " Vis alForce mar; p. " A Vis alForce controller. (isualForce 3ar4up :1 Vis alForce mar; p consists o( Vis alForce tags8 HTG+8 Oa.aScript8 or an* ot&er %e,"ena,led code em,edded wit&in a single <apex: page> tag. T&e mar; p de(ines t&e ser inter(ace components t&at s&o ld ,e incl ded on t&e page8 and t&e wa* t&e* s&o ld appear. (isualForce Control :1 A Vis alForce controller is a set o( instr ctions t&at speci(* w&at &appens w&en a ser interacts wit& t&e components speci(ied in associated Vis alForce mar; p8 s c& as w&en a ser clic;s a , tton or lin;.
Step - :
A(ter Sa.ing t&is page8 clic; on t&is icon to .iew Home page.
3( *o are getting error (or .iew page8 sol.e t&is pro,lem ,* (ollowing some steps.Pi.en ,elow. Clic; on Setup D 3anage )sers D )sers t&en clic; on /dit lin; , tton (or edit ser settings.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 15
T&en *o can (ind De.elopment Gode and c&ec;ed c&ec; ,ox t&en clic; on sa.e , tton. A(ter t&en *o can clic; on .iew icon t&at time8 t&ere is Vis alForce to as; *o to create new page ,eca se t&is page is open in de.elopment mode.
Second type of create (isualForce page : go to we, ,rowser t*pe '1 +8 *o can see ,elow. /x : Http:AA SalesForce lin; a(ter loginAapexA!age ?ame
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 13
%&en *o clic; on Component 1e(erence lin; *o can see new we, page. -n t&is we, page all Component wit& s*ntax are a.aila,le8 w&ic& Component *o want to add O st write in code window. see ,elow. And also see &ow to se Iframe in (isualForce page .
5. Create -.erriding page. 3. Delete /xisting code. and paste it ,elow code. 0. See ,elow code.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 15
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 16
A(ter Clic; on t&is , tton *o can see page redirect Acco nt page. *o can see ,elow.
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 14
www.bispsolutions.com
www.bisptrainigs.com
www.hyperionguru.com
Page 1I