O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Apex Programming

Book Description

Create business applications using Apex to extend and improve the usefulness of the Salesforce1 Platform

In Detail

Starting with the syntax and common use cases for developing in Salesforce, this book will teach you how to create and deploy applications on the fly. You will learn how to approach new projects and learn the basics of Apex, including how to use Eclipse and the sandbox.

Salesforce limits and batch processes are explained in an easy-to-understand format, and you will gain a deep understanding of triggers, classes, test coverage, and Visualforce pages. You will also discover how you can share your Force.com data and code with the outside world and how to integrate with Google calendar using Apex.

Finally, the book covers the creation of real-world web service integrations with Salesforce.com; you will create a Force.com application from start to finish using Apex as the business logic. By the end of this book, you will know all the best practices for development using Apex.

What You Will Learn

  • Create an Eclipse workspace and a sandbox, and learn about IDE best practices
  • Write code within the limits of the platform and discover the best practices to stay out of trouble with queries
  • Understand transactional and batch processes
  • Discover classes and triggers and the best practices for using both
  • Design a Visualforce page using Apex and JavaScript
  • Customize sites to display Visualforce pages to the world
  • Integrate Google and Salesforce calendars

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Learning Apex Programming
    1. Table of Contents
    2. Learning Apex Programming
    3. Credits
    4. Foreword
    5. About the Authors
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
        3. Instant updates on new Packt books
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Apex Assumptions and Comparisons
      1. Before you start
      2. A gift to our readers
      3. Safety first
      4. The Force.com IDE
      5. Getting comfortable with Eclipse
      6. Linking Eclipse to the Salesforce1 Platform
      7. Under the hood
      8. Data and metadata
      9. Writing code
      10. Summary
    10. 2. Apex Limits
      1. Exceptions prove the rule
      2. Embracing an exception
      3. An exception to end all exceptions
      4. Obeying the speed limit
      5. More limits
      6. Edition limits
      7. API limits
      8. E-mail limits
      9. Time and relative limits in space
      10. You want me to process how many records?
      11. How many times and how many things
      12. Techniques to avoid query limits
      13. These aren't the queries you're looking for
      14. Visualforce limits
      15. Summary
    11. 3. More and Later
      1. Chain reactions
      2. Where we're going, we don't need roads
      3. I fought the law and won
      4. Please sir, I want some more
      5. Combining forces
      6. Bigger, better, and batchier
      7. Dyna batch
        1. More than meets the eye
      8. Building skynet
        1. More scheduling options
      9. Master control
      10. Summary
    12. 4. Triggers and Classes
      1. A brief history of triggers
      2. Trigger happy
      3. Pulling the trigger
        1. Execution time
      4. Inside the mind of a trigger
        1. All for one and one for all
      5. Class is in session
        1. Inner space
        2. Share and share alike
      6. Staying classy
        1. Wrap it up
        2. No libraries, no problem
        3. Rinse, lather, and repeat
      7. Put your hands together
      8. Behind the scenes
      9. The Pablo Picasso of Apex
      10. Summary
    13. 5. Visualforce Development with Apex
      1. s-con, what?
      2. Your own personal Force.com
        1. Creating a Visualforce page
        2. Not much to see here
      3. Tag, you're it!
      4. Taking control
        1. Tags that bind us
        2. Paging the doctor variable
        3. Actions speak louder than methods
        4. Ajax your actions
        5. Communication is key
        6. Param face
        7. Put your hands together
      5. Extending control
      6. More internal goodies
        1. Global variables
        2. Functions galore
      7. Static cling
      8. Dynamic pages
        1. Creating a custom label
        2. Creating a custom setting object
        3. Data-driven pages
      9. Visualforce components
      10. Your component library
      11. Controlling components
      12. Summary
    14. 6. Exposing Force.com to the World
      1. Three ways to skin a cat
        1. Seeing is believing
          1. What happened?
        2. At your service
          1. Let's REST
          2. Getting SOAP
      2. JavaScript buttons jubilee
      3. For your consideration
        1. Pros and cons
        2. Limits
        3. Pitfalls and gotchas
          1. Profile permissions
          2. Code happens
      4. My turn!
        1. Permissions again…
        2. Let's get loud
        3. Well RESTed
          1. Console my Force.com developer
        4. Squeaky clean
          1. Anonymous Eclipse
      5. Summary
    15. 7. Use Case – Integration with Google Calendar
      1. Gimme an O!
      2. Googol
        1. Hello, I'm new
        2. Ooo shiny!
        3. Needle in a haystack
      3. Forget me not
      4. I'm late, very, very late!
      5. O, Auth me mighty Google!
        1. Manual labour
        2. Let me google that for you
        3. Not so fast
        4. My, aren't we busy?
          1. Custom settings
          2. Picking up where we left off
      6. Summary
    16. 8. Creating a Property Management Application
      1. Why
      2. What
      3. Who
      4. How
      5. When and Where
      6. A custom model
        1. Account (standard object)
        2. Contact (standard object)
        3. Property (custom object)
        4. Rental Unit
        5. Rental Agreement (custom junction object)
        6. Statement (custom object)
        7. Payment (custom object)
        8. The Authorize.net setting (custom setting)
      7. Paying your dues
      8. Mine, all mine
        1. Black magic
        2. I did it my way!
      9. Ain't no mountain
      10. Upgrade to the app status
      11. Summary
    17. 9. Test Coverage
      1. @isTest
      2. Always on my mind
        1. The rundown
        2. At the parallel
        3. Products
        4. Batches and @future
        5. Workflows and validation rules
      3. Get tested
        1. Helping hands
        2. Itchy trigger finger
        3. Mocking you
        4. AI – Sans input
        5. Batch tests
      4. Fruits of our labour
      5. The ultimate goal
      6. Summary
    18. Index