Apex for Admins: Beyond the Basics


Published on

Final installation of the 3 part webinar series! Time to use all the Apex skills you have learned in this series and combine SOQL with Apex to build one glorious trigger.

This series serves as an Introduction to Apex for Salesforce Administrators with no programming background. This is the last in a 3-part series with David Liu and LeeAnne Templeman. David Liu is the creator of sfdc99.com, an intro to Apex exercise guide for all Salesforce Admins. David is a self-taught Salesforce MVP who began his path as a marketer and is now the Salesforce Technical Architect for Google. He will share some of his own learning path, as well as tips and tricks on how to become a Salesforce developer.

Key Takeaways

::Learn the principles of a good test class
::Maintain your data quality by writing a deduping trigger
::Get an outline of the steps to become a Salesforce Developer

Apex for Admins series:
::Get Started with Apex in 30 Minutes!
::Build on the Basics
::Beyond the Basics ← you are here!

Intended Audience

::Salesforce Admins who have begun learning Apex. You should be familiar with basic triggers, Apex classes, and basic Apex.
::Anyone who joined us last week for Apex for Admins: Build on the Basics
::If you missed the previous session, get up to speed with these awesome tutorials from sfdc99.com:
Chapter 2: SOQL: A Beginner’s Guide
Chapter 3: Core Apex Tools

Recommended Resources

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • (LT)
  • (LT)
  • (LT - Intro)

    (LT – Intro David)

    (DAVID– Intro)

    (LT– Talk about David’s learning path, he is going to share with us today)

  • Are you going to dreamforce this year? ADD DEVELOPER DISCOUNT CODE TO DF SLIDE
  • (LT)

    - mention upcoming series


  • Shoutout to winners?

    Talk through actual types of queries – list them a bit more

  • Shoutout to winners

    Talk through basic variable concepts

  • David takes this one
  • David


  • LeeAnne
  • David will start writing it out and explain the steps

    Reference that they can access the code at SFDC99 blog

    Run it!
  • LT to take
    - in a workflow you only have access to the current record, using SOQL you can access any record in the database


  • David to demo this trigger in an org

    IF statements, no test class, we will see if the trigger works
  • Need Qs from David
  • LT
  • Apex for Admins: Beyond the Basics

    1. 1. Apex for Admins Beyond on the Basics! May 29, 2014
    2. 2. #forcewebinar Safe Harbor Safe 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 salesforce.com, 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 non- salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, 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. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
    3. 3. #forcewebinar Speakers David Liu Technical Architect, MVP @dvdkliu LeeAnne Templeman Developer Evangelist @leeanndroid
    4. 4. #forcewebinar Engage with the Community @salesforcedevs / #Apex4Admins Salesforce Developers Salesforce Developers The video will be posted to YouTube & the webinar recap page (same URL as registration). This webinar is being recorded!Success Community
    5. 5. #forcewebinar Have Questions?  Don’t wait until the end to ask your question! – Technical support will answer questions starting now.  Respect Q&A etiquette – Please don’t repeat questions. The support team is working their way down the queue.  Stick around for live Q&A at the end – Speakers will tackle more questions at the end, time-allowing.  Head to Developer Forums – More questions? Visit developer.salesforce.com/forums
    6. 6. #forcewebinar www.SFDC99.com
    7. 7. #forcewebinar Don’t Miss Out on Dreamforce 2014! http://bit.ly/df14-apex4admins $899 Discount Code: D14DVLPR
    8. 8. #forcewebinar Introduction to Apex: Beyond the Basics  Last Week Recap  Who should be tuning in?  Lists and Dot Notation • Combining SOQL and Apex Triggers • Write your own deduping trigger • Principles of a good test class • Learn more about becoming an #AdminWhoCodes
    9. 9. #forcewebinar http://bit.ly/apex4admins-2
    10. 10. #forcewebinar Recap: SOQL Queries
    11. 11. #forcewebinar Recap: Trigger Variables
    12. 12. #forcewebinar POP QUIZ!  What type of variable would you need to store this myContact.Account.Owner.Id  Write a query that gets all Opportunities with a close date in the future  What kind of data type is this value? true SELECT Id FROM Opportunity WHERE CloseDate > TODAY String Boolean
    13. 13. #forcewebinar Lists
    14. 14. #forcewebinar Dot Notation
    15. 15. #forcewebinar Using SOQL with APEX  Where can we do this?  Most important thing we learn!  95% of triggers  Beyond workflow – Cross multiple objects
    16. 16. #forcewebinar Bind Variable
    17. 17. #forcewebinar Challenge! Which of these movies is overrated? First listener to guess via CHAT wins a Developer Prize Package!
    18. 18. #forcewebinar Which of these movies is overrated?
    19. 19. #forcewebinar Deduping Trigger 1. Lead is created or updated 2. Lead has an email address 3. Try to find matching contact based on email address 4. If match is found, populate a Dupe_Contact__c lookup field 5. If match is not found, clear the value of Dupe_Contact__c lookup field.
    20. 20. #forcewebinar Exercise Let’s write a Deduping Trigger!
    21. 21. #forcewebinar POP QUIZ!  Without SOQL, what fields are available for each record entering a Trigger?  What character must be placed before every Apex variable used in a SOQL query.  What are the three uses of Dot Notation? A colon! (:) Only fields directly on the record are available – related fields are not! - Access fields - Traverse relationships - Use methods
    22. 22. #forcewebinar 4 Principles of a Good Test Class 1. Create Records From Scratch 2. Be “Assert”-ive 3. Break Things! 4. Be “Bulky”
    23. 23. #forcewebinar Principle 1: Create Records From Scratch
    24. 24. #forcewebinar Principle 2: Be “Assert-ive”
    25. 25. #forcewebinar Principle 3: Test Things That Should Not Work
    26. 26. #forcewebinar Principle 4: Be “Bulky”
    27. 27. #forcewebinar SOQL APEX Challenge! Other than testing in bulk, which testing principle is this class missing? First listener to guess via CHAT wins a Developer Prize Package!
    28. 28. #forcewebinar Other than testing in bulk, which testing principle is this class missing? Test things That Should Not Work – Negative Testing
    29. 29. #forcewebinar Exercise! Let’s write a Test Class for our Deduping Trigger!
    30. 30. #forcewebinar POP QUIZ!  Why shouldn’t a developer query for production records in a Test Class?  Why should every test class use System.assertEquals() even if your code works 100% of the time? Your code may break in the future as your org changes over time. For example, a new validation rule could prevent one of your triggers from updating certain records. System.assertEquals() will alert you of these scenarios before you find out the hard way. Test code runs without any existing data from both your sandbox and production database! You should always create records from scratch, otherwise you risk test failures down the line.
    31. 31. #forcewebinar What next?  Deployment – Change sets  Visualforce – Upcoming Webinar  Bulkifying – Governor limits  Object Oriented Thinking – Head First Java
    32. 32. #forcewebinar More SFDC99 Tutorials  Continue with chapters 5 & 6  Chapter quizzes  Get Bulky!  Limits
    33. 33. #forcewebinar Recap • Lists and Dot notation • Write your own deduping trigger • Combining SOQL and Apex Triggers • Principles of a good test class • What next? • Becoming an #AdminWhoCodes
    34. 34. #forcewebinar Resources  Developer Forums – http://developer.salesforce.com/forums  SFDC99 – David’s Site – http://sfdc99.com  Join the community – #Apex4Admins
    35. 35. Q & A #forcewebinar David Liu Technical Architect, MVP @dvdkliu LeeAnne Templeman Developer Evangelist @leeanndroid
    36. 36. Survey Your feedback is crucial to the success of our webinar programs. Thank you! http://bit.ly.apexbeyondbasics #forcewebinar