Force.com Apex Code Developer's Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Spring '21 (API version 51.0)
Winter '21 (API version 50.0)
Summer '20 (API version 49.0)
Spring '20 (API version 48.0)
Winter '20 (API version 47.0)
Summer '19 (API version 46.0)
Spring '19 (API version 45.0)
Winter '19 (API version 44.0)
Summer '18 (API version 43.0)
Spring '18 (API version 42.0)
Winter '18 (API version 41.0)
Summer '17 (API version 40.0)
Spring '17 (API version 39.0)
Winter '17 (API version 38.0)
Summer '16 (API version 37.0)
Spring '16 (API version 36.0)
Winter '16 (API version 35.0)
Summer '15 (API version 34.0)
Spring '15 (API version 33.0)
Winter '15 (API version 32.0)
Spring '14 (API version 30.0)
Enum Methods
Exception Class and Built-In Exceptions
JSONToken Enum
Trigger Class
Glossary
Newer Version Available
System Namespace
The System namespace
provides classes and methods for core Apex functionality.
The following are the classes in the System namespace.
-
Address Class
Contains methods for accessing the component fields of address compound fields. -
Answers Class
Represents zone answers. -
ApexPages Class
Use ApexPages to add and check for messages associated with the current page, as well as to reference the current page. -
Approval Class
Contains methods for processing approval requests. -
Blob Class
Contains methods for the Blob primitive data type. -
Boolean Class
Contains methods for the Boolean primitive data type. -
BusinessHours Class
Use the BusinessHours methods to set the business hours at which your customer support team operates. -
Cases Class
Use the Cases class to interact with case records. -
Comparable Interface
Adds sorting support for Lists that contain non-primitive types, that is, Lists of user-defined types. -
Continuation Class
Use the Continuation class to make callouts asynchronously to a SOAP or REST Web service. -
Cookie Class
The Cookie class lets you access cookies for your Force.com site using Apex. -
Crypto Class
Provides methods for creating digests, message authentication codes, and signatures, as well as encrypting and decrypting information. -
Custom Settings Methods
Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, flows, Apex, and the SOAP API. -
Database Class
Contains methods for creating and manipulating data. -
Date Class
Contains methods for the Date primitive data type. -
Datetime Class
Contains methods for the Datetime primitive data type. -
Decimal Class
Contains methods for the Decimal primitive data type. -
Double Class
Contains methods for the Double primitive data type. -
EncodingUtil Class
Use the methods in the EncodingUtil class to encode and decode URL strings, and convert strings to hexadecimal format. -
Enum Methods
An enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. Apex provides built-in enums, such as LoggingLevel, and you can define your own enum. -
Exception Class and Built-In Exceptions
An exception denotes an error that disrupts the normal flow of code execution. You can use Apex built-in exceptions or create custom exceptions. All exceptions have common methods. -
Http Class
Use the Http class to initiate an HTTP request and response. -
HttpCalloutMock Interface
Enables sending fake responses when testing HTTP callouts. -
HttpRequest Class
Use the HttpRequest class to programmatically create HTTP requests like GET, POST, PUT, and DELETE. -
HttpResponse Class
Use the HttpResponse class to handle the HTTP response returned by the Http class. -
Id Class
Contains methods for the ID primitive data type. -
Ideas Class
Represents zone ideas. -
InstallHandler Interface
Enables custom code to run after a managed package installation or upgrade. -
Integer Class
Contains methods for the Integer primitive data type. -
JSON Class
Contains methods for serializing Apex objects into JSON format and deserializing JSON content that was serialized using the serialize method in this class. -
JSONGenerator Class
Contains methods used to serialize objects into JSON content using the standard JSON encoding. -
JSONParser Class
Represents a parser for JSON-encoded content. -
JSONToken Enum
Contains all token values used for parsing JSON content. -
Limits Class
Contains methods that return limit information for specific resources. -
List Class
Contains methods for the List collection type. -
Location Class
Contains methods for accessing the component fields of geolocation compound fields. -
Long Class
Contains methods for the Long primitive data type. -
Map Class
Contains methods for the Map collection type. -
Matcher Class
Matchers use Patterns to perform match operations on a character string. -
Math Class
Contains methods for mathematical operations. -
Messaging Class
Contains messaging methods used when sending a single or mass email. -
MultiStaticResourceCalloutMock Class
Utility class used to specify a fake response using multiple resources for testing HTTP callouts. -
Network Class
Represents a community. -
PageReference Class
A PageReference is a reference to an instantiation of a page. Among other attributes, PageReferences consist of a URL and a set of query parameter names and values. -
Pattern Class
Represents a compiled representation of a regular expression. -
Queueable Interface
Enables the asynchronous execution of Apex jobs that can be monitored. -
QueueableContext Interface
Represents the parameter type of the execute() method in a class that implements the Queueable interface and contains the job ID. This interface is implemented internally by Apex. -
QuickAction Class
Use Apex to request and process actions on objects that allow custom fields, on objects that appear in a Chatter feed, or on objects that are available globally. -
RemoteObjectController
Use RemoteObjectController to access the standard Visualforce Remote Objects operations in your Remote Objects override methods. -
ResetPasswordResult Class
Represents the result of a password reset. -
RestContext Class
Contains the RestRequest and RestResponse objects. -
RestRequest Class
Represents an object used to pass data from an HTTP request to an Apex RESTful Web service method. -
RestResponse Class
Represents an object used to pass data from an Apex RESTful Web service method to an HTTP response. -
Schedulable Interface
The class that implements this interface can be scheduled to run at different intervals. -
SchedulableContext Interface
Represents the parameter type of a method in a class that implements the Schedulable interface and contains the scheduled job ID. This interface is implemented internally by Apex. -
Schema Class
Contains methods for obtaining schema describe information. -
Search Class
Use the methods of the Search class to perform dynamic SOSL queries. -
SelectOption Class
A SelectOption object specifies one of the possible values for a Visualforce selectCheckboxes, selectList, or selectRadio component. -
Set Class
Represents a collection of unique elements with no duplicate values. -
Site Class
Use the Site Class to manage your Force.com sites. -
sObject Class
Contains methods for the sObject data type. -
StaticResourceCalloutMock Class
Utility class used to specify a fake response for testing HTTP callouts. -
String Class
Contains methods for the String primitive data type. -
System Class
Contains methods for system operations, such as writing debug messages and scheduling jobs. -
Test Class
Contains methods related to Visualforce tests. -
Time Class
Contains methods for the Time primitive data type. -
TimeZone Class
Represents a time zone. Contains methods for creating a new time zone and obtaining time zone properties, such as the time zone ID, offset, and display name. -
Trigger Class
Use the Trigger class to access run-time context information in a trigger, such as the type of trigger or the list of sObject records that the trigger operates on. -
Type Class
Contains methods for getting the Apex type that corresponds to an Apex class and for instantiating new types. -
UninstallHandler Interface
Enables custom code to run after a managed package is uninstalled. -
URL Class
Represents a uniform resource locator (URL) and provides access to parts of the URL. Enables access to the Salesforce instance URL. -
UserInfo Class
Contains methods for obtaining information about the context user. -
Version Class
Use the Version methods to get the version of a managed package of a subscriber and to compare package versions. -
WebServiceCallout Class
Enables making callouts to SOAP operations on an external Web service. This class is used in the Apex stub class that is auto-generated from a WSDL. -
WebServiceMock Interface
Enables sending fake responses when testing Web service callouts of a class auto-generated from a WSDL. -
XmlStreamReader Class
The XmlStreamReader class provides methods for forward, read-only access to XML data. You can pull data from XML or skip unwanted events. -
XmlStreamWriter Class
The XmlStreamWriter class provides methods for writing XML data.