B778-fdc-wiki-cookbk.gif

The Force.com Cookbook

The Force.com Cookbook provides a set of recipes for implementing specific functionality in your Force.com applications. The recipes in the Cookbook provide expert methods, patterns, and solutions for building and improving on-demand apps, using all the technologies that contribute to the power of the platform.

This wide-ranging volume includes techniques for modifying standard Salesforce components, using workflow and approvals, searching and retrieving data in a number of ways, modifying default data actions and integrating applications through the use of Email or the Web services API. The book also contains helpful hands-on exercises to help you use a variety of tools that support the Force.com platform.

The examples in the book were contributed by Force.com experts, including some of the leading engineers on the Salesforce.com R&D team. The Cookbook brings together savvy, real-world advice from long-time Force.com experts.

Sample chapter

Chapter 4 of the Cookbook is freely available via this download.

Download the entire book

If you are a member of Developer Force, you have full access to the entire Cookbook in PDF format . If you are not a member, simply register to get FREE access.

Table of Contents

Table of Contents

Section 1: Searching and Querying Data

Using the Enterprise WSDL and the AJAX Toolkit to Examine Your Data Model

  • Using SoqlXplorer to Examine Your Data Model
  • Choosing Between SOQL and SOSL
  • Querying Multiple Related Objects Using Relationship Queries
  • Finding a Contact, Lead, or Person Account
  • Retrieving Data Based on a Relative Date
  • Finding Search Data Based on Division
  • Previewing Query Results
  • Sorting Query Results
  • Viewing Tags
  • Viewing Records with Tags
  • Writing Shorter Queries Using Outer Joins
  • Making Apex Work in any Organization

Section 2: Managing Workflow and Approvals

  • Managing Large Opportunities Using Time-Based Workflow
  • Managing Lost Opportunities Using Workflow
  • Using Workflow to Notify Case Contact for Priority Cases
  • Using Workflow to Add Account Names to Opportunity Names
  • Requiring Parallel Approvals for Large Campaigns
  • Using a Matrix-Based Dynamic Approval Process
  • Sending Outbound Messages with Workflow
  • Tracking Outbound Messages from Workflwo
  • Updating a Field on a Parent Record

Section 3: Customizing the User Interface

  • Overriding a Standard Button
  • Creating a Button with Apex
  • Creating a Consistent Look and Feel with Static Resources
  • Formatting a Currency
  • Building a Table of Data in a Visualforce Page
  • Building a Form in a Visualforce Page
  • Creating a Wizard with Visualforce Pages
  • Creating Custom Help
  • Creating a Custom Visualforce Component
  • Overriding a Standard Page
  • Redirecting to a Standard Object List Page
  • Dynamically Updating a Page
  • Overriding a Page for Some, but not All, Users
  • Referencing an Existing Page
  • Defining Skeleton Visualforce Templates
  • Creating Tabbed Accounts
  • Adding CSS to Visualforce Pages
  • Editing Multiple Records Using a Visualforce List Controller
  • Selecting Records with a Visualforce Custom List Controller

Section 4: Displaying Data and Modifying Data Actions

  • Creating a Many-to-Many Relationship
  • Storing and Displaying Confidential Information
  • Averaging Aggregated Data
  • Displaying Fields from a Related Record on a Detail Page
  • Blocking Record Creation with Cross-Object Validation Rules
  • Validating Data Based on Fields in Other Records
  • Using Query String Parameters in a Visualforce Page
  • Using AJAX in a Visualforce Page
  • Using Properties in Apex
  • Mass Updating Contacts When an Account Changes
  • Bulk Processing Records in a Trigger
  • Using Batch Apex to Reassign Account Owners
  • Controlling Recursive Triggers
  • Comparing Queries Against Trigger.old and Trigger.new
  • Preventing Duplicate Records from Saving
  • Creating a Child Record When a Parent Record is Created
  • Using Custom Settings to Display Data
  • Using System.runAs in Test Methods
  • Integrating Visualforce and Google Charts
  • Using Special Characters in Custom Links

Section 5: Creating Public Websites

  • Registering a Custom Domain for Your Force.com Site
  • Using Force.com Site-Specific Merge Fields
  • Customizing the Look and Feel of Your Force.com Site
  • Adding a Feed to Your Force.com Site
  • Creating a Sitemap File
  • Creating a Web-to-Lead Form for Your Force.com Site

Section 6: Integrating with Other Applications

  • Retrieving Information From Incoming Email Messages
  • Creating Records From Information in Incoming Email Messages
  • Retrieving Email Attachments and Associating Them with Records
  • Creating Email Templates and Automatically Sending Emails
  • Email Recipes - Complete Code Example
  • Updating Salesforce.com Data in the Mobile Application
  • Retrieving a User's Location from a GPS-enabled Phone
  • Enabling Single Sign-On with the Force.com Platform
  • Implementing Single Sign-On for Clients

Section 7: Integrating Applications with the API and Apex

  • Setting Up Your Salesforce.com Web Services API Applications
    • Select a Development Language
    • Create an Integration User
    • Select a WSDL
    • Generate a WSDL Document
    • If You Use the Partner WSDL
    • Log In to and Out Of the API
    • Manage Sessions
    • Change the Session Timeout Value
  • Implementing the query()/queryMore() Pattern
  • Batching Records for API Calls
  • Using a Wrapper Class for Common API Functions
  • Building a Web Portal with Salesforce.com Data
  • Add and Remove Tags on a Single Record
  • Add and Remove Tags on Multiple Records
  • Updating Tag Definitions