ApexOld

Apex Code

Force.com Apex Code is a strongly-typed programming language that executes on the Force.com platform. Apex is used to add business logic to applications, to write database triggers, and to program controllers in the user interface layer. It has a tight integration with the database and query language, good web services support, and includes features such as futures and governors for execution in a multi-tenant environment.

Overview of Apex Code

An Introduction to Apex Code: A technical introduction to the Apex programming language, looking at its syntax, features, and use on the Force.com Platform.

Apex Code: The World's First On-Demand Programming Language: Whitepaper that provides an overview of the capabilities and technology of Apex.

Introduction to Apex : Recorded presentation of the Apex code overview.

Other Articles

How to Write Good Unit Tests

Apex Code Best Practices

Governors in Apex Code

An Introduction to Apex Code Test Methods

Security Tips for Apex and Visualforce Developers


Official Documentation

Force.com Apex Code Developer's Guide
Version 17.0 for Winter '10: HTML | PDF | Governor Limits | Earlier Versions
(Audience: Developers) Reference for Apex, a Java-like programming language that allows you to add custom logic to your apps.

Apex Quick Start Tutorial
Basic Tutorial | Advanced Tutorial
(Audience: Developers) A quick start tutorial introduction to the Apex programming language.

Presentations

Apex Deep Dive: Advanced Apex Techniques: Recorded at Dreamforce '08, this presentation looks at using Apex to developer Email services, dynamic Apex and asynchronous Apex.

Apex Test Coverage Best Practices: Recorded at Dreamforce '08, this presentation examines Apex test coverage and how it impacts how the deployment of high-quality apps on the Force.com Platform.

Apex Code Demo: Recorded demo of a few apps created with Apex

Getting Started with Apex Code: Introduction to Apex Code from Dreamforce '07.

Calling Web Services from Force.com (formerly Force.com SOA): Recorded demo highlighting the capabilities of Force.com for calling external Web services.

Code samples

The following code comes straight from the free Force.com Cookbook.


Image:Icon doc sm.gif Avoiding runtime governor limits

Image:Icon doc sm.gif Avoiding runtime governor limits - alternative

Image:Icon doc sm.gif Avoiding runtime governor limits - alternative 2

Image:Icon doc sm.gif Avoiding runtime governor limits - inefficient alternative

Image:Icon doc sm.gif This is a helper class called by line 17 & 18

Image:Icon doc sm.gif Avoiding runtime governor limits - alternative 3

Image:Icon doc sm.gif Preventing duplicate lead entry, using maps

Image:Icon doc sm.gif Tester application for lead de-deduplicator

Image:Icon doc sm.gif Correlating query results with maps

Image:Icon doc sm.gif Controlling recursive triggers with member variables

Image:Icon doc sm.gif This one should be linked to the one above - it is a sub-taks

Image:Icon doc sm.gif Tester application for recursive trigger

Image:Icon doc sm.gif Hello World' application defined as a web service

Image:Icon doc sm.gif S-control that calls the web service.

Image:Icon doc sm.gif Apex class to determine test coverage.

Image:Icon doc sm.gif Trigger that calls class method

Image:Icon doc sm.gif Class called by trigger in 38.

Image:Icon doc sm.gif Trigger to create new records

Image:Icon doc sm.gif Trigger to update data in child records

Image:Icon doc sm.gif Populate values in child record from parent record

Image:Icon doc sm.gif Web service called from a pushbutton

Image:Icon doc sm.gif Pushbutton that calls a Web service

Image:Icon doc sm.gif Pushbutton to delete multiple records

Image:Icon doc sm.gif Pushbutton to update multiple records

Image:Icon doc sm.gif Template for a custom help s-control

Image:Icon doc sm.gif Reading a parameter in an s-control

Image:Icon doc sm.gif Passing a parameter to an s-control

Image:Icon doc sm.gif Redirecting a User to an Edit, Detail, or List Page

Image:Icon doc sm.gif Trigger to update multiple records (part of a solution to receive email updates every time a record changes)

Image:Icon doc sm.gif S-control to format currency (part of roll-up summary field for different types of opportunities)

Image:Icon doc sm.gif S-control snippet (part of roll-up summary field for different types of opportunities)

Image:Icon doc sm.gif S-control to display data from a related record on a detail page

Other Code Samples

Image:Icon doc sm.gif Force.com Email Services - Create tasks from Emails

Image:Icon doc sm.gif Unsubscribe from emails with Email Services