Posts

Showing posts from October, 2016

Dynamic DML in Salesforce

Dynamic DML (Data Manipulation Language) in Salesforce refers to the ability to perform insert, update, upsert, delete, and undelete operations on records dynamically at runtime. This is particularly useful when you need to work with records whose types or quantities are determined dynamically, based on user input or other runtime conditions. Salesforce provides several ways to perform dynamic DML operations, primarily through Apex, the programming language used on the Salesforce platform. Here's an overview of how dynamic DML operations can be achieved in Salesforce: Dynamic DML Operations in Apex: In Apex, you can use dynamic DML statements to perform DML operations on records dynamically. This involves constructing DML statements as strings and then executing them using methods like Database.insert(), Database.update(), Database.upsert(), Database.delete(), or Database.undelete(). Example // Define a list of sObjects to perform DML on List<SObject> recordsToInsertOrUpdate...

Salesforce Query Languages - SOQL & SOSL

In Salesforce, both SOQL (Salesforce Object Query Language) and SOSL (Salesforce Object Search Language) are query languages used to retrieve data from the Salesforce platform, but they serve different purposes and have distinct syntaxes. SOQL (Salesforce Object Query Language) : SOQL is a query language used to retrieve records from a single object or related objects in Salesforce. It's similar to SQL (Structured Query Language) and is tailored specifically for querying Salesforce data. Key features of SOQL include: SELECT Statement: Used to retrieve specific fields from records. Filters and Conditions: WHERE clause allows filtering records based on specified conditions. Relationship Queries: Allows querying related objects using relationship fields. Aggregate Functions: Supports aggregate functions like SUM(), AVG(), MAX(), MIN(), and COUNT(). Ordering and Sorting: ORDER BY clause enables sorting results based on specified fields. Example of a SOQL query: SELECT Id, Name, Accou...