You are on page 1of 512
By BENED SOFTWARE rce No 1 Training Institute for Salesforce.com in India Development Material (Apex, VisualForce, Deployments) Completed 150+ Batches 300+ Students Placed 500+ Students Certified 13 Corporate Trainings in MNC's 80+ Workshops on integrations & Webservices *** 3 Months Internship in MNC's*** on Salesforce.com Trainer: Satish Myla New Bathes & Workshops starts on every Saturday Contact for Demo: +91-7799458889 Bened Software (P) Ltd, €-3-219/1, 4th Flog, OTDC Opp Building, Near Saradhi Studio, Ameerpet-38. Ph: 040-66781355/56 &1 w.benedsoft.com 5 BENED SOFTWARE Drive for Exe INDEX S.NO TOPIC NAME PAGE NO 1, When Should | Use Apex 1 2. How Does Apex Work 2 Object Oriented Programming (Oops) 3. Data Types 3 4. Class 5 5. Access Modifiers 6 6. Class Variables s 7. Object 9 8. Constructors 10 9, Usage of Apex Program With in VF Page i 10. Reffering to the Apex Class In VF Page 12 11, Example for Getter Method 13 12. Apex Class to Demonstrate Setter Method 14 13. Call Apex Methods in A VF Page 15 14, Simple Apex Class 16 15. Array 17 Bened Software (P) Lid, 8-3-219/1, 4" Floor, DTDC Opp Building, Near Saradh! Studio, Ameerpet Ph:+91-40-66781355/56, traming@benedsoft.com www.benedsoft.com BENED SOFTWARE prive fo 16. Pick List Using Select Option from Apex 18 17. Collection © List 20 * Set 24 © Map 27 18. SOQL Queries 32 19. Child to Parent Relationship On Standard, Custom Objects 40 20. Example Program 4 21. Parent to Child Relationship On Standard, Custom Objects 43 22.SOSL Queries 46 23, Email Programming 49 * Outbound Email Service 50 * PDF File Attachment 34 © Inbound Email Service 58 24, DML Operations 62 25. Interface Iterator 67 26. Interface Iterable 70 27. Database.QueryLocator Class Ps 28. Batch Apex 73 © Start Method ¢ Execute Method ¢ Finish Method Bened Software (P) Ltd, 8-3-219/1, 4" Floor, OTDC Opp Building, Near Saradhi Studio, Ameerpet. Ph:+91-40-66781355/56, training@benedsoft.com www.benedsoft.com BB BENED SOFTWARE Brive for &: 29. Invoking Of Batch Apex Job 30. Order Of Execution Of Batch Apex Jab 78 31. Database. Stateful 81 32. Governing Limits,Limitations 83 33. Apex Scheduler 84 34, Real Time use cases for Batch, Schedule Apex 89 34. Testing 100 35. Batch Apex Example With Test Case 106 36. Schedule Apex Example With Test Case 107 37. Triggers & Examples 109 38. Invokong Apex methods in Triggers 124 39.Recursive Triggers 40. Order of Execution Of Triggers 131 41. Future Annotation 139 42, Apex Sharing Rules 142 43. Flows Introuduction 146 © Process.Plugin Interface ‘© Input parameters Output Parameters 44, Plug in Program 150 45. Select Option 154 46. Schema Programming 156 47. JSON(JavaScript Object Notation) 167 48. http Callouts 180 49. JQUERY 183 Bened Software (P) Ltd, 8-3-219/1, 4" Floor, DTDC Opp Building, Near Saradhi Studio, Ameerpet. Ph:-+91-40-66781355/S6, training@benedsoft.com www.benedsoft.com 5 BENED ow Exe 50. Introduction to VisualForce Page 51. Apex Components mn © Apex Page © Formula & Expressions in VF © Apex PageBlock Formula Expressions © PageBlock Section ¢ PageBlock Buttons ¢ Command Button ¢ Command Link © PageBlock Section Item Apexlnput Components Input Text Input Secret «Input Hidden © Input Checkbox © Input Text Area # Select List Select Option * Select Options © Select Radio © Input Field * Select CheckBox 53. Java Script in VF Page * Introduction to Java Script © Arrays in Java Script © Methods in Java Script © Reading Sobject data in Java Seript sale pre. 1 189 190 197 205 © Reading VF input component data in Java Script © Validations in Java Script 54. Page Block Table 217 Bened Software (P) Ltd, 8-3-219/1, 4! Floor, OTDC Opp Building, Near Saradhi Studio, Ameerpet. Ph:+91-40-66781355/56, tre com, www.benedsoft.com, JB BENED SOFTWARE Drive for Exeilence 55. Data Table 56. Data List 57.Apex Tab 58. Insert & Include 59. VF Page in PDF Format 60. Action function, Action Region, Action Support 61. Real Time Scenarios 62. Reports & Dashboards in VF 63. Google Maps in Salesforce 64. CSS 65, Remote Method invocation Java Script 6. deployments . ey Eclipse * Us ny Change at et Tnteqrations salesfOroe 3m 223 224 226 229 238 240 249 256 261 270 NOfE t= You can collect Toteqaotions & kebsesuicog avd book C65 Pager) B nook beok of 20 pages toon Front Dee. TS Cues all intequations Croumples (sip -STEBEL ,Not Suite; Tava. net (Tea & vrany ‘Trwke), Bened Software (P) Ltd, 8-3-219/1, 4" Floor, DTDC Opp Building, Near Saradhi Studio, Ameerpet Ph:+91-40-66781355/56, trainina@benedsoft.com www.benedsoft.com Ee BENED SOFTWARE alegfSrce.cor in 2 Days Workshop Batch Starts Salesforce Integra‘ on every Saturday 1. Introduction to API's > Meta Data API SOAP API REST API Chatter API Bulk API ‘Streaming API vvvvY 2. Meta Data API > introduction Meta Data API Advanced Programs > Deployments into different org’s. 3. Introduction to Web Services > Difference between Http 1.0 and Http 2.0 Introduction to SOAP API Types of WSDL files and their purposes Creating Web Service classes in SFDC Consuming external WSDL file in Salesforce Salesforce to Salesforce integration using Enterprise WSDL Salesforce to Salesforce intergration using Partner WSDL Salesforce to Salesforce Integration using Apex WSDL Consuming Salesforce resource in java using Enterprise WSDL Consuming Salesforce resource in java using Partner WSDL Callouts using SOAP services from Apex Chatter Example using SOAP AP{ Vv vVvvVvVY viv 4. Introduction to HTTP > 1HttpRequest 2.HttpResponse > 3.JSON Parsing > 4.XML Parsing S 5. Introduction to Rest API > Creating a Rest methods in Salesforce » Consuming Salesforce Rest Resource in Salesforce > Introduction Authorization ‘ened Software (P) Ltd, 8-3-219/1, ath Floor, DTDC Opp Building, Near Saradhi Studio, Ameerpet-38. Ph: 040-66781355/56 training@benedsoft.com www.benedsoft.com gz BENED pains for Exellence Authorization using 5 API keys YouTube Integration with Salesforce using API Key Face book integration using Salesforce Difference between OAuth 1.0 and OAuth 2.0 Authorization using the OAuth2.0 Web Server Authorization using the OAuth2.0 User-Agent Authorization using the OAuth2.0 Username Password Authorization using the OAuth2.0 refresh token Calling Third-Party services using HTTP Callouts( Two examples) VvVYVYVvVY | Google Maps and Google API's using HTTP callouts and using JavaScript Single Sign On Integration using OKTA Marketo Integration with salesforce 9. OnDemand integration with salesforce 10. Salesforce.com sites integration as Twitter/Facebook 11. Informatica Integration using Rest API 12. CAST IRON Integration 13. Outbound Messages 14. Chatter API > Introduction to Chatter API > Advanced program Oxo 15, JIRA CRM and Net suite CRM integrations Formats Many More to .. Bened Software (P) Ltd, 8-3-219/1, ath Floor, DTDC Opp Building, Near Saradhi Studio, Ameerpet-38. Ph: 040-66781355/56 training@benedsoft,com www.benedsoft.com JB BENED SOFTWARE fp - Drive for Exel Lene Interview Questions Every Bened Student can answer these questions 1) Visualforce Basic Questions 1. What is view state in visual force? 2. Which api used to design visual force page? 3. What is the difference between actionSupport and actionFunction 4, What is the actionRegion? 5. What is difference between insert and include? 6. 7. 8 9 . How do you use static resource in VF page’ What is remote action? How many records we can print a pageBlock What is the difference between related List enhanced List ,detail 10. What is the difference between controller and extension? 11. What is Ajax? Have you used it?if so tell the scenario ? 12. What is Jquery ? Where you have used? 13, What is S-Controls? 14, What is the use Static Resource in Visual force? 15. Can I pass parameters from VF page to apex method? 16. How do you refer to current page id 17. Tell me something $Action 18. How do you embed Google map in visual force? 19. How do you pass the parameters from page to page ? 20, What are custom components? 21. How do you make a VF pag: lable for Salesforce! 2) Apex fundamentals waene Bened Software (P) Ltd, 8: What is Apex? What API is used in the apex? What are the access modifiers in the apex? Whaat is the difference between With Sharing and Without Sharing? What is a constructor? What is the use of the static variables? 219/1, 4” Floor, DTDC Opp bulding, Near Saradhi Studio, Ameerpet, Hyd-38. Ph: +91-40-66781355/56 training@benedsoft.com, www. benedsoft.com gg BENED SOFTWARE salegfonce om Drive for Exellence 7. What are reference variables in apex? 8. What are Sobjects? 9, What is the difference between List and Set? 10, What is Map in apex? 11. Can we have duplicate Keys in Map 12, How many objects we can store in list? 13, What are setter and getter methods? 14, How do you refer to current page id in apex”? 15, How to do you invoke standard actions in apex class? 16, What is page reference? 17. How do you pass the parameters from om apex class to another to another? 18. What is virtual class? 19, What is interface? 20, What is abstract class? 21, What is overloadin; 22. What is overriding, 23. When we invoke with sharing method in without sharing class Now method is Executed as? 24, Will the inner class inherits the sharing properties of outer class? 25. Base class is declared as With Sharing and Derived class is declared as without Sharing what will happen? 26. Can I have constructor with parameters in apex? 27. Dereferncing a Null pointer value error? 28. Variable is not available? 29. Too many Records: 10001 3) Batch Apex and Schedule apex questions. What are the Soql limitations in apex? What are transaction limits in apex? What is the need of batch apex? ‘What is Database.Batchable interface? Define the methods in Batchable interface? ‘What is purpose of Start method in batch apex? What is the Database. QueryLocator? What is the Iterable. Cops fundarnentale 3. Doda. types 10 Apex. 4 Aecoss Modifiers S. Methodls . 6. Apex. classes JL. Obieck Cmation &, Consteactors 9, Grektus & setters matheds lo. calling Apex Mmembeas iy visualfoxo Ip. Uisualfeea with Apex Examples on Apex. ® Al Apex ig a Strongly typed object osiemtad proysamming languoge: —> Ut allows the developers to execute long and tvangaction Contsol Statements. —> Apex ernbles Pauclepuss to add business logic to most eystorn events lie buttery clicks velatel vecord updates ard uisualleke Pages. : — Apex far ) Sees ed 2 Ot prides built in guppost feb pac alls, 1) Inlone Galesfrica ebiect quesy language & w Eaay to use, eo 4 Y Eaay to toot. W) Vexsion ul) Multi tenant awaxe When should ¢ use Apex :- >To Greate email Sumuice, * — Conte nebsasyices, — pastor complex validation overs ‘roultiple objects, > TO create Complex. businese procesees that oxo not suppdted by Wwort flew. —> Create Custom teansaction logic. —> Attach cisterns logic to anothes opasation. { } | All Apex programs suns entively ON—darnand on Foxe: corn Platidmn. How does Apex Hick t- —> Fieet the platform application oS Comnpiles the Cede into ae absteact cet of Tnttsuctions that ain be Uirdusctood by Apoa santime intexpmtes. — > The Corapile Cede is Stowed to reetadata- > ban the ord ais tigqeas the execution of Apex by click button 8) wigualf{ece fog the application Serer netsionee tho Cornpiled insteuctions fron the ‘etadata and send thom to Sun time tesprokts below rekeroring the verult. Obiuct oriented programming Coops) — Cop (obiect ovierntect prograuremring) is a Trotherblogy that prouicles o Hoy ot vredulanising & program by cxeating fastitiond mernosy aac. $8 both dato and ‘wethecs that aad-B, ed as tormplate fo} Creating copia of Such recules Cobiécts) on darsard. Unlita. procedural Peogravmmning phase in tho COP progam veal, progams asc dyanized csvcund objects yy oo rathas than action and Lone. athe ‘rain cops principles oxo Encapsulation Intositarce Polyrresphism. Eraaptulation - “he ksvapeing cap of data cond Trethods tegethag is called oncapsulation. Fob example, if no tage aclag, We woite tho uasiables and methads Maide the class. Thus ; clase te bbireling tforn together fo Cast 18 ain example fed encapsulation, Dobesitance - H ceccrtes nen claseee fsorm exisisting Chases, so brat the new clagees will cxcgtaine tl the feature of the exisicting chases is called Inhesitance. : A qed example #3 Inloritance in natuw ic fasents perducing the childson and chibsen Tohexiting Che qucalition of tho pasents. polyrresphis ny - Polyreaphicm vepresents one for in Yraltiple Poors. Dr Propsorming ; We Cn wae A singe vowel to relay to objects af differant types ard variable We call the Yrethade of differant Call con pestorm differant taseg 1 Cbyect - Apes fundamentals s— . Dato pe = : > Dota type im the Apex ero! type of data can be tored. a > What is tho AN hat can be Sipsed. y Premnilitle da we WW) collecti r WY) Eoume \) prerntive data ‘tegpeg 1 These ase the cata types cohich axe Por defined by the Apex, —? A Prewitiue dala types Such aa an Integas ; Double Lemp Pate, Date Rina, String, 1D 8 Brokaw, QB AS —> All Prermitiua chte types o%@ fared by vole not by wferonce. > Al Apex vostables, nhathas theiy or class member Vassiables axe “witiakided © vu) Make cuse that We isitiali2e Uassiables to appsopsiode Wakies before using thom. Apox Premitive datatypes trclude = Boolean '- A, valu tot an only be cuigned tous folsench rad, Egr Boolean isActive = false; 3 Dette A value thot indicates a. paviticulas day. Datowlealuss Contain tno ‘wfosmation about time Dato Ualueg must Guuoays be created With G& Systern Static method. Xe Date Toypate = Date. reninatante (2.018 , OF) '5)) Output 1S 2012-05-15 0 100:00 Time and DateTrne these die, date types axseciated with datey and mag along with Pate cis tym. the Hane dodo. typer Stovey Limes Chowne, tivutes, Secon and yill’secords). the Dose chia types Stowes chica (eau month and day) . the Datetime Chtactype tower both dates ard Frnes Each of these clases haga teaTnstanee method pith cahich tye can Conrieet Pawticulay date and time Uoleas . Eqz Trme tt = now Tnatance (tq; 20)! 2); olp B 19:20:01 Apexi — bie can also create cate and ma som te Cusvent sutsrent clock . Dote my = Dotetime non); Pate += Date today}: —> The date and time classes alo have instance motheds 2% Conuesting fromm one format to anotinars . EQ- Tino tg Date time. Non). mac )- — > We can ako manipulste the valued by wat “vastanc. methede. EQ? Dodo 43> Dake today ©), Dette Noxt = » wie will get s Cute Q013 - ao ran Int — TO Stove Dummaic value ‘nm as \ “A doe Of the Nuyresic data types, a -f 3 Dumbay that doen't trelude a cwetwal podat: Toveguns haue A minima Value of 2, 4, 483,648 and @ wate valuo of &) 1Yt, 48s, HF Eg Totegers teh “A A A An nA a re Apex-1 i At Jong’ A o Bit “ambea that doem't include a decimal point. (orgs have a Minimum Valux of —263 avd a maximum Vales of 263-l qr dong P= AUFHBSREL, Doulle- A cip-bit rermbag that incladag a dacinml psmnt - Doubles hase a minima Value of —263 and a Tdximum vale of 263-(, Gyr Ooubl d = 2.14159" OS) Decimal — Ay rumbes that treludes a ceciypal polab: niin is an Oxbitasy Precision nuymbus . Curmency Prades axe alte ratioally Oseigned Che tym docival . C ; > Decivral dac= 19-23; d Nall variables - 20 ne ceclawe a uaa! cond con't initialiae it With o Valus t willbe null Nae yoens the absence of auoless Aue can algo asKign a vault to any vasniable doclard witha : Promitive type Both of these Stafemenic Beault & a Vasiable set tonull . Boolean y= pull Deckert a; Steing + Stoings ose setof chawactege cond ear anclosed ina Srp quetel. thay ctore text valu guchag a name San actos, Egy mb di= Mate todas ) . Staing S = Sting Valeo AD; The ofp of above exampk Should be today’s dae. 20/3-06- 6. SObieck Types — An Sobiect , can be a gpresic SObiect os be a Specific Sabjects, Such ag cn Account Contact os MYCustorn__c. > Sobjects (shoot fox “salerforee chiects") axe Ctardax & custom objects that Stoves secosd data in tho Fase Com database. these ic ako an Sobject data type iy Apex that is Negrratic Depsertntation of thee SObiects and thie > Durclopers wefes to Sobiects and APL Names. Br Account a =new fleco My Gustomobiect—C obiect -_C OY L API name of & J =) the foll ouirg are Mgt ‘an invoice Statement Nith S7e ‘mitiad CS siption__c fietde and osigns Tnwetee- Statamont——C ,»hich ® an Sobject type ee os) Qs Poyoia -Statement__¢ tv- Nus Device Statement —C Coesesiption_¢ = Great Towite'!, latus c= ‘pording’) = Sobyect Vassiables axe initialised to mulb, bu can be Asxigney a Laid Object weference with the now Operate. RRR RR RRR RRR RRA AAR et ttn Class *- os “Clase isa Collection of datamembars and ‘methede. qr class, Studant Tnteges oe axe dotamembesg a Sting rare: the charg . y Pablic void getDetails _> Thie ic the, wethed System chbug ollno | +ne); ° of the clase) System . debug (‘narre! -trarme); $ 4 Er class Employee i Integug exp; i { > Uowriableg [oedourerntonas Stang dapastmnent Of the clay , Neoid thecoc ) : —snethad of f [hasnt te je Feo” ' § — 370 dafina an Apex class Spacify the following. 1) Accare-madifians*- — You. Tout use oe Of the access Madifiens KS top (enol Clay. (public d.global) —> you do not have to wpe access Wwadifiass ‘in the declaration of Wner chasceg . & 1) optional definition rmedifiess serch io ack Ww Reqrsisucl tthe key ood (| clare rane, lu) Optional extensions | Anofe Rey it merrosy fd tho datamembess aur allocated only whan you Create a object Syntax'- a objeckname = yew clasgrame( 9: fa . “this the Tame \ i | 0" ; Tea Tis Constssct\ . of claga 1Suhon vrelmange Keeps Ge ass coca Vastable — Which cat) an object. PF allocating the oomdy dass Example \\cedo % ample Soma Example); Conctauctor +! Constoudts), iS 0 Spectall wethad Htheh howe the following Poopestiog. +) Methad name will be Sarme ag clase. if) Accessspecifiers, catll be pubic WY This vrothad cell invoked only ome thet is at the fime of Creaking an object - ivy this ig Usted to instantiate the dato. membess of the clas, Ege ~ public chug, TestObiect f \\the 0 Oxgeernent Conttocactos Public Testobject¢ > / \\ Cod 8 $ w These axe 3 types of conttructede U Default Consts 2) Non —posametexizad Ciagteu 3d preametusize TLR Y) Defasete Cretsucithe Tan ae n't Contain any constrect) then Apex 5 ult creates a. deermny Consbuctd} on the Tame Johor eee cwento On Obiect $b the clagy a) F es class Example . Example ¢ = nen Example ¢ >> SOR RR RRR Re AR Rm nen ne ne en AYO Ty tre above exampe, tha apex class dooto't Contain any Constsuctth « $0 whan we create abiect Fo\ Etaumple clas the Apex Corfilag crater adofault Constsuctds. am public excumple¢) $ me %) Non- pawcumetusised d consteuctsh % pasarneberiaed Gonstouctos + Ris cvconstucls ceo 7 any poxouniptess, OF Conetsuctd) Fat hag xCly gr public clas, Example PR \ f Trteqen, ™o Stsing Naw ie Public Exarnple integers Sing mYName) > pa.xametesized| f ‘ Corttsuctor oo = a ame = Toyrarne, & Public -Excunple () eda T0210; | — THIS 1S MOD - parcumetarized Meda vara sm | — Conttyuctox Woite a Apex program to demonstiate Usage of Gonstsuctd. 1) Open daustoper Console wade, by clicking the Nome on the Salestceo page ® dice File & select Apex clasg. 3) Entes the class rome. K) hlvite tha Apor chagg Public class employee String Ermployeo naw » A Integus, Ereployer no; . ee =a © Systero debug ( 'eroplayeename ie ‘+empogeriame), ~ System. ‘debug C'Erplepeno ue ' + Erplagenvo); RT RRR RRR Re nn nen enn AY 5) Open the anongrnous block . Employee CL= Nan Employee ©); Employee 22 = nen cate, 21 Showl >; Q2 Show (); THIS IIL Give avr output Of Employee Naame cp Hast and Employeeno is to. ~O\ Ermploycenawe ts Hani. Employeeno — te, usage of Apex peogwarn ewith within. NiSeal}de poge Ythen get cmt to tse cad Apex clagg tM Visualfedce poge be have to declase ip the Fallessing forrnad < Apex: page Contyolleey ="clyy maine" > ‘ Whenexeg, ke aa Wisualfcke page in which Conteollesy, GHtsibute 1S defined i will fixst create an obiect fA the apex clay bhich ey define in Conten(lers, QY Wham Sbiect ic crsated fos tha Apex clogs first YH invokes the Covttsuctos . \\ | | RePeeving to tho apex clay rrambese in visualteske t LAlbarn your count to refers apex clase yousiables in the wisual fake Fage toe Need to Wye Getta & Settas mothode geee) Public clas, Crarnple Stsing name; : re § get Method :- s When uisualfdxe Page want to “2 Of 0 (ousiahle datiancd mm tho Apex. 3 TAyoke get mathed of that vasiatle &e © haa core RON Pama} ge é b ‘this is 0 Vasiable dafined in apex. close. Bp the aboue rent visual fice page is taying 4o uge Tyrowe \rawiable hich ig daclased in Apex clagg $0 it is invoke autorratienlly getMynamad ) metrod in the apex car and this rethed will telus tho values of that ee ee a Ae am ha ee me public chasg Example f Sting nome 5 Public void set Coring ‘rame) £ — sattas method - this co'lll this. narme = Towne ; take tho alee Prom the & visual{aee Poge ahd) Cnneg te ne ra public Stving gebttamnec ) ye £ — Qettes mmethed this method wetusp Name; uiill vate deualue too % : \tisuall tekoa age Wheneuay q TOM 3 \Vaisiable “ig called. ais Public class Excurrgple t i Pte ero, * pablc void sek (StsimoIniegys no) § this.no =no; & Public Trkequg getNoc > Fetusy VO > 3 3 \a Waite 20 example teh getters, method wsing wWisualtetce and lags ~~ e ple Clase — public cass Exarople Sting Wame ; Public String getName ¢ > f We Betuwn “Tad 5 h £ 8 Example Page + apex outputlabal > © Ahem Nitgualfetea page called : birormeff it woke QetNome () g 4 the por close. § Exampk page Capex : page : comtsollug = YExarmple"> opersoutputlabel > youu name ig f {rome Oukpud [ey &) besiting The alusg into Apox vassiables ror Visual $3. Page - This is called seacyrvite Operation on the vasiable. BE hers pablic oid or NR g this. ee age; r £ (name Prablic _ setNawe (Sti . ame = SS age =O, 3 ee Aly public ran gebigec > betun oge 5 Public oe getNamec > £ Tetuwn ‘san kurmos. ; 4 7) a 4 poe Caper: page contsollas ="Exarnples "> 5 Soper icubputtabel > Fiageg ~Apoxioutputlabel > 2 {roume % Noite an apex class to dotmonstsate Seltesy mnethed 1-2, Pasting the values and sawing tha valuss to Apex Vastableg’ Apex class Public (Class Example! Public Stoing ‘rare 5 | Stoing gptNawe (> deturn ‘arn ; 3 Puble veld stNarne (String name) £ this.name =name y) g & WE page apex page contsalle = “Exarple| > Capex form> Sapet routputtabel> Entos Name 8 $ {nome g <(aper foo NX Copex + rae — We Yan reethads in @ Sing t ublic amlogen sak; got 58 “be ON RR RRM Rm RR eR mee as How to call the apex toathods (1 a Visualfidee page *— Public Clax Perro g Public pageReference Show c) g Betuwn dull / thon we give Tele relirit Ail coma back to the Saime pag. 4 Caper : commmandfatton Vale = “adic nection 2" Pi shotw} than coo cfick on the “click” button tt asl invete Pogerefarance Shon d) nethed —> Pagereference iS the deturn type oft toy emethed that ne howe called -frope visualfetco page . Public class Example | pisblic Sting ‘pawn » Public. Stang getName C ) TokuwN Name ; 3 fesblic void set Nowe (Stsing var) this.name = rane; & Public PageRoferorca Shonc) OMe = ‘This is Tey Tane! +I; seta Nall: é > 3 4 apexipoge Controllers =" % F ne X [apex oulputdabel> = ake ey ‘/> ="dlicte" reRardap ="one" action= "f{ show Z'/> id ="0ne" > lname} Se oon a ee ee ee ee A\b a Strople apex clay to peter addition and wubtyactt on based on the button you haua dlicked. Public dase Grample | 7 Pnteges buakue & fqot jak; & fablic nteqes atialua F get ;sat j2 Public Tavtegas verakt {get set) & Public. Shing epuation fae eo 9 Public PageReferonce Subbt ) f verult =avalua—bvalus ; Operation =‘soareactton'; Tetusn Nuh; g Pubic PageReference subbe ) Degabt = Aryaleee-+bvalees > Operation = ' ADDITION - vekusn well » 3 Capex: osm > Capex :pagepleck title =“calucalata "> apes: page Aleck8eation item > Ager: inpertText ualue = "flan You have Pasrfoomed g {operation Llovalua} ard fi buclue} are the wetuke fLoesult § ae tom> dann Aman ~ aN RN RRR RRR Re RR me eee (. 2. a uo, y dist intauction g G Hethadls i the List COLlEcTTons (17-31) Arssarys Popa to dlisplass areas Of records ty Page block table Progrars to Crate picklist fied my UF Fage Using amwsaug irs Apex . Difference bekexcen Arsay & collection, &) See 4 - Proguary to Permonsts ate Gaga of yn Ape. ~ Exounpla Programs tying Let WN Patt, «Set trhoduction < . Mathads 19 gob «& & + Program to Pomedg rat usage of Keb in AGeox . Exornplo progfearysing cating Sat Ago 8 uisualdbe ap re ion dy e, Methods Ty Hap : Prcgaarn fo Demontteate Grage of Map in Ape y . Excanple programe OFNg Map rex uicuale. Exarnpla to Cxvate Dynamic pitelist sing collections Arras - " Asvay is acollection of Srmilax cements , whasxa the memdy is allocated Sequontly . DatoType C] axraymarne = neva Pataryee[si2e] ; [/1Hs is called dynamic declaration DatoTypel I csvay nore = new PataTyec 1 £ valsot, Vals# 3? ; // : Static daclaxodey Trtequal J masks = New Intequac Tf ©, 20,39}: Account a1 = nen Account (names ‘Saxn)- Account a2 =e Account Croume = 'saun') 5 Account C7] oc = 1H Acgountes fa)a>4 Staingl I St =nw Swirgc 3f “ran, ‘San, Cran § Steingt J St = nen Stoing C4): SICo} =Akumas : SLOQ= ‘Ravi Qe kioita a program to dis plasy asvas of Stsinge in Pog alock Table fur Public clase Avrag Excarnplo i Puble Ctvingt 3 Yoyval Eset; got; 9 Public Stsing vane f get ser; % pablic Assay Exarnpled) g ‘name = 'prarad' ; 7 nen SingcT § 'sam', Gam, NS. 3? Oper: Page @otolleg = “pray apa: fooan > Sapay re Caper: rng \ mytal 9" vos = "a> Kaper: Fes LayA a Soper { name} £ Account At = neny Account (name ='sash;', ordustay = Banging » Account a.=nen Account( name =" Rew! ', Trdustey="Banting'); Acomunt ag =new Acepent( raxee = ‘prcwteen’, Trekastey ‘carting’ ); tryvol = Naw Accorun tc J fay, 034) 4 5 apex; poge Contiol (ay = “Avrayexarnple SS Xaper:poim> Capex : pageBlock > Sop: pogeslockTanle value =") myval” wag e's LAporrcoluwmn Valew = “Slamames '/> SOPexicolumn vabu = "Fla. trckuatey 3 '/> f Inova } <(apexrform> S/apex:page> pterlist csi ng Selectoption Salectoption, from Apex — ty COper: Sclackdist Siae= y's “a ket 'scap'/> i we "SOFC"/> » Seloctoption Op3 = Ten selactoption (‘null | '~Wore-l)- Lelsctaption Opr = row Celactoption C ‘ore’, Ntan'); AA RnR Rr AAA ame AY solactoption op2= nen sdactoption( ten, “feb', nenyoptions = Ton Seloctoptionc 3f 03 oP! ,0p23 § 5 apex: forrm> Caper sSelactfist side =| > 5 < (apex -gglodopions > ~Popericalacktist > Napor: soloctlist dive =“ Cs Sapex:solactoption ‘temlahel = “Java” ttermUaluo="Taue] <(apen:celactoption > Sapex:seloctoption ‘itembabel = "sEOc" HomValua="sp "> (apex :selectoption > <(apex :colact List > Sager form > C(aper:page> Collections — Diffesence betewsoor Foray ard collections . Avra collecting . [-shewary ic a collectionot (BE ts acollection of homogents a8 Csinilos) Cloynants. Q.AArroys can not Grow ord shrink dyramtally, 3. Avrauys can be acest Posters curd leg ranrrory . ue ORgeMa MOSe Yer - — Ust 1S an i > A list Collection of clamante that arg Clistingerished thois Mrdicoy. bi > ust dae fn he of any cia type pwmitive type, collectione , sobjocks , sew -dafined type ound badltin por types - RAR RRR RR a ees Bnkx0, Under | Brdew2 inden 3 Index a Gren | elas yeltero | Red Black] — Inrestion Sees is prosentued. can grow yramically at sun time , > Puplicate Ualuos are allowed. = net valeos ase acepted. Methods im List clas .— add Coblect)'— Adda an clrment to the ondof therlit . add_(Integos obiect) - Drsests an clerndnt into the list at tho Specified \odex position. add Al| CHist) + Adds all of there alemerite in the cpecifiad bt to tho list that calls tho Teethndy Both Liste musthe of the Sarm type. addt!| (set) - Add oll of the clerrants in spocified Set to the (i that alle the. rfothe|. The St and the list wart be Of the Sarre type: Cleaure y— Removes all dlemente Prom a List , Consegtuantty Cetting tte bot’ hogth to 2e%0 . Clone >'= Mages a duplicate Copy of alist: deepclone (oolean ,Bealean Boolean) {— Maer a duplicate copy of a List 6 eOblect secords, Indleeding tha sChicct records kK thorcolues . equals (ast) ‘~ Camnparey this list with tho Specified list and sotum trug MH both liste ax cqual - Otherwise doturng alu. get Enteges) — Returns the lect clamert Stosedat tha apocified index. get sObiect Type C) Retusne the tokun o thot mares ep @ ligtof sObiacte. hashCode)‘ Ratusrs the hash ~~ [2St ard ita Contents . > the le Baso damneants, an ttevads’\ fh this lst. TAERmptyC) = Retume tewatadc ) = Pekcenns a ® varmoua (Inte: > Qpreifeed, tr tte (ict alament Stead at the Jr sets tte Specified wakes fob tho Claimant at gue ‘oder, LZCO) = Potusne tho rembey of clorments ty the list. Gost ‘= Sorts the Teme tw the [ist TH ascerdiing Owns. ih tho Qhamant Chat coag whowd | oe a a a A A on a A2\ ae List Stv= Pon lst C); Stsing Siz ‘saxo' Sting S) = (Rar; Sting 88= ‘Raw; Str-ackl (st) 7 Stp-add (82 5 Sto add (1,$2); List Realist ETON List > 5) Eimaldsct acall Cota), String x= Sto: get); /] Rawi s Woite a psogsarn to domenstsalo the list Public cae ListExarsple f Public List result {set ; get; Public ListExangle ¢) - i TOME = New LisrsSteing><¢ eau. add ('sam') ; Boalt add (‘sarn'); Begult add ¢' haxi'); SeBult- add (1, ‘keumas, "5; 43 a apex: page Controle, = “ListExample" > apex: pagplock> Capen :pogeslocctabe ‘value = "$1 derelt $ “! vay stall Sapericolermn ualus = “$ 1a g's S (apex: pasealock Tale s Japon: pagerlock> § > Sage: page > List of objects Dero Petblic clag Liste: Public List

You might also like