Mastering Advanced Visualforce

  • View

  • Download

Embed Size (px)

Text of Mastering Advanced Visualforce

Colors/Artwork (delete this slide when done)

Advanced Visualforce17th December 2014#forcewebinar1SpeakerPaul BattissonTechnical Architect, Mavens ConsultingSummer 14 MVP@pbattisson

#forcewebinar#forcewebinar Casts


#forcewebinar#forcewebinar Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include but are not limited to risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available., inc. assumes no obligation and does not intend to update these forward-looking statements.#forcewebinar@salesforcedevs / #forcewebinarGo Social!

Salesforce Developers+Salesforce DevelopersSalesforce DevelopersSalesforce DevelopersThe video will be posted to YouTube & the webinar recap page (same URL as registration).

This webinar is being recorded!

#forcewebinar Dont wait until the end to ask your question! Technical support will answer questions starting now.Respect Q&A etiquettePlease dont repeat questions. The support team is working their way down the queue.Stick around for live Q&A at the endSpeakers will tackle more questions at the end, time-allowing.Head to Developer ForumsMore questions? Visit Questions?

#forcewebinarAgendaAssumptions/baseline settingPage PerformanceViewstateApex CodeResourcesSome TipsAsynchronous Pages#forcewebinarBefore We StartI will show code snippetsThey are all shared!

#forcewebinarAssumptionsYou are comfortable with Visualforce!You are comfortable with Apex!

#forcewebinarPage PerformanceViewstate#forcewebinarWhat is ViewstateWhenever an tag is present on a Visualforce page an encrypted, hidden field is addedThis page tracks the state of the Visualforce page and Apex controller between server requestsIt is the state of the current view within our MVC setup#forcewebinarWhat does it track?Non-transient data members in the related controller and controller extensionsObjects reachable from non-transient data members in controllers and controller extensionsThe pages component tree and associated stateHousekeeping data for Visualforce (small amount)#forcewebinarWhat Fields Require Viewstate?

#forcewebinarHow it is utilised

#forcewebinarPositives and Negatives of ViewstateWhy it is greatWhy it is not so greatAutomatically tracks field values for youEnables AJAX to be simpleAllows re-rendering of the pageIs (rather can be) bulkyLimited to 135KBComplex AJAX is not really possibleDifficult to understand the bottlenecks

#forcewebinarPage PerformanceApex#forcewebinarSlow Methods Affect Page Performance

#forcewebinarMain Apex Items Impacting Page PerformanceExpensive/Long Running CodeSlow queriesInefficient loopingSynchronicity#forcewebinarPage PerformanceResources#forcewebinarJavascript, CSS and ImagesSalesforce static resources make the loading of JavaScript, CSS and Images easierCDN based deliveryCachingBundling in zip filesNo cross site requests#forcewebinarTips#forcewebinarTransient KeywordThe transient keyword can be applied to data members that are only required for the duration of the page requestItems marked as transient are not stored and transmitted in the viewstate#forcewebinarInitial Code Not Transient

#forcewebinarUpdated Code - Transient

#forcewebinarViewstate Size ChangeDemo!

#forcewebinarQuery SpeedEnsure queries return the smallest amount of data possibleUtilise indexed fieldsStandard: Name, Id, RecordTypeId, CreatedDate, LastModifiedDate, Foreign Keys, Email (Lead and Contact only)Custom: External Ids, Unique Fields, Custom Indexes Query & Search Optimization Cheat Sheet#forcewebinarLooping Through CollectionsNot all looping methods are equalSlowfor(Integer i=0; i