Apex Reference Guide
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)
No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Release Notes
CommerceOrders Namespace
Context Namespace
DataRetrieval Namespace
ExternalService Namespace
Flowtesting Namespace
IndustriesDigitalLending Namespace
InvoiceWriteOff Namespace
PlaceQuote Namespace
RevSignaling Namespace
RevSalesTrxn Namespace
Slack Namespace
Apex Reference Guide
Apex is a strongly typed, object-oriented programming language that allows developers
to execute flow and transaction control statements on the Salesforce Platform server, in
conjunction with calls to the API. This reference guide includes built-in Apex classes,
interfaces, enums, and exceptions, grouped by namespace. It also includes Apex DML
statements to insert, update, merge, delete, and restore data in Salesforce.
For information on the Apex development process, see Apex Developer Guide.
In API version 51.0 and earlier, Apex Reference information was included in the Apex Developer Guide in the Apex Language Reference section.
Note
-
Apex Release Notes
Use the Salesforce Release Notes to learn about the most recent updates and changes to Apex. -
Apex DML Operations
You can perform DML operations using the Apex DML statements or the methods of the Database class. For lead conversion, use the convertLead method of the Database class. There is no DML counterpart for it. -
ApexPages Namespace
The ApexPages namespace provides classes used in Visualforce controllers. -
AppLauncher Namespace
The AppLauncher namespace provides methods for managing the appearance of apps in the App Launcher, including their visibility and sort order. -
Approval Namespace
The Approval namespace provides classes and methods for approval processes. -
Auth Namespace
The Auth namespace provides an interface and classes for single sign-on into Salesforce and session security management. -
Cache Namespace
The Cache namespace contains methods for managing the platform cache. -
Canvas Namespace
The Canvas namespace provides an interface and classes for canvas apps in Salesforce. -
ChatterAnswers Namespace
The ChatterAnswers namespace provides an interface for creating Account records. -
CommerceBuyGrp Namespace
The CommerceBuyGrp namespace provides classes and methods for retrieving information about the buyer groups associated with a user. -
CommerceExtension Namespace
Use the CommerceExtension namespace to define resolution strategies for registered Commerce extensions. -
CommerceOrders Namespace
The CommerceOrders namespace provides classes and methods to place orders with integrated pricing, configuration, and validation. -
CommercePayments Namespace
Use the CommercePayments namespace to provide a safe and customizable platform for managing customer payments and refunds. -
CommerceTax Namespace
Manage the communication between Salesforce and an external tax engine. -
Compression Namespace
The Compression namespace provides classes and methods to create and extract zip files. -
ConnectApi Namespace
The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce. -
Context Namespace
The Context namespace provides classes and methods to manage the sharing and consumption of business application data by using Context Service. -
Database Namespace
The Database namespace provides classes used with DML operations. -
Datacloud Namespace
The Datacloud namespace provides classes and methods for retrieving information about duplicate rules. Duplicate rules let you control whether and when users can save duplicate records within Salesforce. -
DataRetrieval Namespace
The DataRetrieval namespace provides classes and methods to record details of customer-agent engagements, as well as transcripts of their conversations. -
DataSource Namespace
The DataSource namespace provides the classes for the Apex Connector Framework. Use the Apex Connector Framework to develop a custom adapter for Salesforce Connect. Then connect your Salesforce organization to any data anywhere via the Salesforce Connect custom adapter. -
DataWeave Namespace
The DataWeave namespace provides classes and methods to support the invocation of DataWeave scripts from Apex. -
Dom Namespace
The Dom namespace provides classes and methods for parsing and creating XML content. -
embeddedai Namespace
The embeddedai namespace provides classes and methods to manage and represent records and data in Apex to support embedded AI features. -
EventBus Namespace
The EventBus namespace provides classes and methods for platform events and Change Data Capture events. -
ExternalService Namespace
The ExternalService namespace provides dynamically generated Apex service interfaces and Apex classes for complex object data types. -
Flow Namespace
The Flow namespace provides a class for advanced access to flows from Apex such as from Visualforce controllers and asynchronous Apex. -
Flowtesting Namespace
The flowtesting namespace provides dynamically generated Apex classes for flow tests that are created in Flow Builder. -
FormulaEval Namespace
The FormulaEval namespace provides classes and methods to evaluate dynamic formulas for SObjects and Apex objects. Use the methods to avoid unnecessary DML statements to recalculate formula field values or evaluate dynamic formula expressions. -
fsccashflow Namespace
The fsccashflow namespace provides classes used in the FSCCashFlow Flexcards and its child Flexcards. -
Functions Namespace
The Functions namespace provides classes and methods used to invoke and manage Salesforce Functions. -
industriesNlpSvc
Stores the objects used in Industries Einstein Natural Language Processing (NLP) services. -
IndustriesDigitalLending Namespace
The industriesDigitalLending namespace provides classes used in the Digital Lending OmniScripts and Integration Procedures. -
Invocable Namespace
The Invocable namespace provides classes for calling invocable actions from Apex. -
InvoiceWriteOff Namespace
The InvoiceWriteOff namespace provides classes to create credit memos with the total charge amount on the invoice as the write-off amount. -
IsvPartners Namespace
The IsvPartners namespace provides a class associated with Salesforce ISV partner use cases, such as optimizing code, providing great customer trial experiences, and driving feature adoption. -
KbManagement Namespace
The KbManagement namespace provides a class for managing knowledge articles. -
LxScheduler Namespace
The LxScheduler namespace provides an interface and classes for integrating Salesforce Scheduler with external calendars. -
Messaging Namespace
The Messaging namespace provides classes and methods for Salesforce outbound and inbound email functionality. -
Metadata Namespace
The Metadata namespace provides classes and methods for working with custom metadata in Salesforce -
PlaceQuote Namespace
The PlaceQuote namespace provides classes and methods to create or update quotes with pricing preferences and configuration options. -
Pref_center Namespace
The Pref_center namespace provides an interface, classes, and methods to create and retrieve data in forms in Preference Manager. Preference Manager, previously called Preference Center, is a feature within the Privacy Center app. -
Process Namespace
The Process namespace provides an interface and classes for passing data between your organization and a flow. -
QuickAction Namespace
The QuickAction namespace provides classes and methods for quick actions. -
Reports Namespace
The Reports namespace provides classes for accessing the same data as is available in the Salesforce Reports and Dashboards REST API. -
RevSignaling Namespace
The RevSignaling namespace provides classes to extend the standard procedure plan implementation through custom logic. A procedure plan helps you set up your procedures, configure the procedure execution settings, and relate them to a context definition in one centralized location based on your requirements. -
RevSalesTrxn Namespace
The RevSalesTrxn namespace provides classes and methods to create a sales transaction, such as a quote or an order, with integrated pricing and configuration. -
RichMessaging Namespace
Provides objects and methods for handling content in enhanced Messaging channels. -
Salesforce_Backup Namespace
The Salesforce_Backup namespace provides classes and methods for Salesforce Backup. -
Schema Namespace
The Schema namespace provides classes and methods for schema metadata information. -
Search Namespace
The Search namespace provides classes for getting search results and suggestion results. -
Sfc Namespace
The Sfc namespace contains classes used in Salesforce Files. -
Sfdc_Checkout Namespace
The Sfdc_Checkout namespace provides an interface and classes for B2B Commerce apps in Salesforce. -
Sfdc_Enablement Namespace
The sfdc_enablement namespace provides classes for creating custom learning items to implement custom exercise types in Enablement programs. Lightning web components are used to render the custom exercises on Program Builder. -
sfdc_surveys Namespace
The sfdc_surveys namespace provides an interface for shortening survey invitations. -
Site Namespace
The Site namespace provides an interface for rewriting Sites URLs. -
Slack Namespace
The Slack Namespace provides tools designed to accelerate and ease the process of developing Slack apps on the Salesforce platform. -
Support Namespace
The Support namespace provides an interface used for Case Feed. -
System Namespace
The System namespace provides classes and methods for core Apex functionality. -
TerritoryMgmt Namespace
The TerritoryMgmt namespace provides an interface used for territory management. -
TxnSecurity Namespace
The TxnSecurity namespace provides an interface used for transaction security. -
UserProvisioning Namespace
The UserProvisioning namespace provides methods for monitoring outbound user provisioning requests. -
VisualEditor Namespace
The VisualEditor namespace provides classes and methods for interacting with the Lightning App Builder. The classes and methods in this namespace operate on Lightning components, which include Lightning web components and Aura components. -
Wave Namespace
The classes in the Wave namespace are part of the CRM Analytics Analytics SDK, designed to facilitate querying CRM Analytics data from Apex code. -
Appendices