Use these Salesforce developer’s interview questions and answers to prepare for your interviews
1. What is the difference between 15 character IDs and 18 character IDs in salesforce?
The 15 character ID is a case-sensitive version which is referenced in the Salesforce user interface while the 18 character ID is the case-insensitive version which is referenced through the APIs. These IDs can be safely compared for uniqueness by case-insensitive applications, and can be used in all API calls when creating, editing or updating, or deleting data.
2. What does trigger new contains?
Trigger. New contains all the records that were inserted in insert or update triggers. Trigger. Old provides the old version of sObjects before they were updated in update triggers, or a list of deleted sObjects in delete triggers.
3. What is database BatchableContext in Salesforce?
Database. BatchableContext represents the parameter type of a batch job method and contains the batch job ID.
4. What is trigger oldMap?
Trigger.oldMap: A map of IDs to the old versions of the sObject records. Note that this map is only available in the update and delete triggers.
5. What is SOQL used for?
The Salesforce Object Query Language (SOQL) is used to search your organization’s Salesforce data for specific information. SOQL is similar to the SELECT statement in the widely used Structured Query Language (SQL) but is designed specifically for Salesforce data.
6. Which two strategies should a developer use to avoid hitting governor limits?
This question is about the Apex Trigger best practices. Any two of the following could used
- One Trigger per object.
- Logic-less Triggers.
- Bulkify your Code. Bulkified triggers operate on all sObjects in the trigger context. Typically, triggers operate on one record if the action that fired the trigger originates from the user interface. But if the origin of the action was bulk DML or the API, the trigger operates on a record set rather than one record.
- Avoid SOQL Queries or DML statements inside for Loop.
- Using Collections, Streamlining Queries, and Efficient for Loop.
- Querying Large Data Sets.
- Use @future appropriately.
- Context-Specific Handler Methods.
7. What is the return type of SOQL in Salesforce?
A SOQL query will always return a list of sObjects. However, if you assign a query that returns no records or more than one record to a singleton sObject variable, you will get an exception
8. What is standard list controller in Salesforce?
Standard list controllers allow you to create Visualforce pages that can display or act on a set of records. Examples of existing Salesforce pages that work with a set of records include list pages, related lists, and mass action pages.
9. What is StandardSetController and why we use it?
StandardSetController Class. StandardSetController objects allow you to create list controllers similar to, or as extensions of, the pre-built Visualforce list controllers provided by Salesforce.
We always use the pre-built Visualforce list controller because it prevents list view from displaying unbounded data. It also allows the developer to configure list view to display up to 100 records at a time, but by default it returns 20 records on the page.
10. What is Apex Triggers
Apex triggers enable you to perform custom actions before or after events to records in Salesforce, such as insertions, updates, or deletions. In general, you use triggers to perform operations based on specific conditions, to modify related records or restrict certain operations from happening
Look out for more Q&A