You can add and interact with data in the Lightning Platform persistence layer. The
sObject data type is the main data type that holds data objects. You’ll use Data
Manipulation Language (DML) to work with data, and use query languages to retrieve data,
such as the (), among other things.
-
Working with sObjects
In this developer guide, the term sObject, when used as a placeholder value, refers to any object that can be stored in the Lightning platform database. -
Data Manipulation Language
Apex enables you to insert, update, delete or restore data in the database. DML operations allow you to modify records one at a time or in batches. -
SOQL and SOSL Queries
You can evaluate Salesforce Object Query Language (SOQL) or Salesforce Object Search Language (SOSL) statements on-the-fly in Apex by surrounding the statement in square brackets. -
SOQL For Loops
SOQL for loops iterate over all of the sObject records returned by a SOQL query. -
sObject Collections
You can manage sObjects in lists, sets, and maps. -
Dynamic Apex
-
Apex Security and Sharing Model
The Apex security model includes record-level, field-level, and object-level security mechanisms. You can control record-level security modes by using the with sharing, without sharing, and inherited sharing keywords on classes. Apex runs in user mode by default, which means that user permissions on objects and field-level security are respected. A user cannot run code that tries to access fields or objects that are hidden from the user. Other security mechanisms include the Security.stripInaccessible() method, and Field and SObject describe methods. -
Custom Settings
Custom settings are similar to custom objects. Application developers can create custom sets of data 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. Formula fields, validation rules, flows, Apex, and SOAP API can then use this data.