Learn All About Salesforce Apex Programming Language
What is Apex?
In the CRM cloud platform, Apex is an object-oriented programming language that has syntax similar to Java, which is also an object-oriented language. APEX has built-in functions or procedures to handle operations such as inserting, updating, deleting, and handling DML errors. It creates schema objects directly from schema objects like sObject.
In addition to releasing and updating Apex with every Salesforce release, Apex is automatically included with the Salesforce cloud platform.
These are some of the important apex applications:
- Create web services and integrate them with external systems.
- Email services.
- Create custom transactional logic.
- Perform complex validation over several objects at once, and also perform custom validation.
The Apex platform works with SOSL and SOQL query languages designed specifically for Salesforce.
Don't forget to check out: Apex Design Patterns: The Singleton Pattern in Salesforce
Apex SOSL refers to Salesforce Object Search Language. SOSL can search across multiple objects for a particular string. It has the following capabilities:
- Many objects can be searched at a time.
- It can be used in classes but not in triggers.
- DML operations cannot be performed on searched results.
- It can only query EMAIL, text and phone type of fields. The results are not objects.
- The results are the fields, not the objects themselves.
A Structured Object Query language (SOQL) is used for DML operations
such as INSERT, UPDATE, DELETE, UPSERT, etc. It has the following capabilities:
- Only one object can be searched at a time.
- It can be used in classes and triggers and can query all type of fields.
- DML operations can only be performed on query results.
- Record-level operations only return records.
Apex Classes can be Executed in So Many Ways in Salesforce:
- Scheduling the apex class.
- Using triggers or process builder.
- Using web services.
- Using SOAP or REST API.
- Using an anonymous block.
Check out another amazing blog by Mohit here: Salesforce Lightning Component Framework - Learn All About it Here
A trigger is a stored procedure which executes when a given event occurs. Triggered events are those that can be executed before and after an event occurs on a record.