Salesforce Interview Questions – Part 1

Share This Post

1. Give me an example of one admin part and one development part which is used in the current organization?

2. What is the difference between a data loader and a data import wizard?

Data Import WizardsData Loader
You need to load less than 50,000 records.You need to load 50,000 to five million records. If you need to load more than 5 million records.
The objects you need to import are supported by the wizard.You need to load into an object that is not supported by the Data Import Wizard.
You don’t need the import process to be automated.You want to schedule regular data loads, such as nightly imports

3. What is the difference between batchable and schedulable classes?

Schedulable ClassBatchable Class
It divides the whole process into batches (each batch handles 200 records at a time).First, need to implements the Salesforce-provided interface Database.Batchable
first needs to implement the Schedulable interface for the classFirst, need to implement the Salesforce-provided interface Database.Batchable
The Schedulable interface contains one method that must be implemented, executeThe Batchable interface contains three methods that must be implemented, Start, Execute, Finish
Run Scheduled Class like that :
YourScheduleApexClass s=new YourScheduleApexClass();
s.execute(null) ;
Run Batch Class like that :
Id <variable name>= Database.executeBatch(new <Class name>(), batch size);

4. What are the future methods?

A future method runs in the background, asynchronously. You can call a future method for executing long-running operations. Each future method is queued and executes when system resources become available. the execution of your code doesn’t have to wait for the completion of a long-running operation.

5. What are the governor’s limits?

Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits so that runaway Apex code or processes don’t monopolize shared resources. These limits count for each Apex transaction.

For Batch Apex, these limits are reset for each execution of a batch of records in the execute method.

Apex Transaction Limits

6. What is the difference between soql and sosl?

We can query all fields of any datatypeSOSL(Salesforce object Search Language)
Using SOQL we can Search only on one object at a time.We can perform DML operations on query results.
Using SOSL we can search for many objects at a time.We can use it in classes but not in Triggers.
We can use SOQL in Triggers and classes.We can query only on fields whose data type is text, phone, and Email.
We can perform DML operation on query results.We cannot perform DML operation on search result

7. How to write a test class?

@isTest
private class MyTestClass {
@isTest static void myTest() {
// code_block
}
}

8. What are the different types of events in triggers?

Here is a list of trigger events in Salesforce:

  • before insert
  • before update
  • before delete
  • after insert
  • after update
  • after delete
  • after undelete

9. What are the different types of flows?

The Salesforce Flow can be classified into five subtypes-

  1. Screen flows
  2. Schedule-triggered flows
  3. Autolaunched flows
  4. Record-triggered flows
  5. Platform Event-triggered flow.

10. What are the different uses of record-triggered and schedulable triggered flows?

Uses of Scheduled Triggered Flow:

  • A schedule-triggered flow starts at the specified time and frequency.
  • The View All Data permission is required to activate an auto-launched flow that has a trigger.
  • If a flow is scheduled to run once with a date and time that already passed, the flow doesn’t run.

Uses of Record-Triggered Flow:

  • A record-triggered flow can start after the record is created or updated.
  • The View All Data permission is required to activate an auto-launched flow that has a trigger.
  • Only these elements are supported: Assignment, Decision, Get Records, and Loop.

11. Write a test class for updating account records?

@isTest
public class testAccountUpdate {

 @testSetup static void dataSetup() {
  Account acc = new Account();
  acc.Name = 'Person 1';
  insert acc;
 }
@isTest static void accountUpdate() {
  Account acc = [SELECT Name, Phone FROM Account WHERE Name='Person 1'];
  acc.Phone = 'xxx-xxx-xxxx';
  update acc;
  
 }
}

12. What is a mixed dml error?

This error will occur when you try to persist in the same transaction and change to a Setup Object and a non-Setup Object.

For e.g. if you try to update an Opportunity record and a User record at the same time.

13. What are states in vf?

View state holds the state of the Visualforce page. the view state of a web page is composed of all the data that’s necessary to maintain the state of the controller during server requests (like sending or receiving data).

14. What is the API used during deployment?

Salesforce continues to support the use of checkStatus() when using deploy() with API version 28.0 or earlier.

15. What are the differences b/w queueable and future?

Future MethodQueueable Job
1. Future will never use to work on SObjects or object types.1. Queueable Jobs can contain the member variable as SObjects or custom Apex Types.
2. When using the future method we cannot monitor the jobs which are in process.2. When using queueable jobs it will make the AsyncApexJob which we can monitor like Scheduled jobs.
3. The future method cannot be called inside the future or batch class.3. Queueable Apex can be called from the future and batch class.
4. The future method will never be queued.4. Using Queueable Apex will chain up to queueable jobs and in Developer Edition it is only 5 Jobs.

16. What is the flow of data in lwc?

We can Flow the data between components in Two way

LWC Data Flow
  1. Parent to Child (Passing Data Down)
  2. Child to Parent (Passing Data Up)

17. What is the difference b/w workflow & process builder?

Workflow is able to update some fields

  • Update a field
  • Send an email
  • Create a Task
  • Send an outbound message

Process Builder is capable of updating any field that has any related record.

  • Create A New Record
  • Update Any Related Record
  • Quick Action To Create A Record, Update A Record Or Log A Call
  • Launch A Flow
  • Send An Email
  • Post To Chatter
  • Submit For Approval
  • Call Apex Methods

18. What is relationships in salesforce?

Relationship is the way in which two or more people or things connected with each other.

Different types of Relationships in salesforce.

  • Master-Detail relationship.
  • Lookup Relationship.
  • May-Many Relationship.
  • Hierarchy Relationship (we can not use this relationship).

19. What is the difference between Master-details & look-up relationships?

Master-detail RelationshipLookup Relationship
in master-detail relationship field value is mandatoryin lookup relationship field value is not mandatory
If parent record is deleted automatically child records is deletedIf parent record is deleted automatically child records are not deleted
an object is allowed only 2 master-detail relationship fieldsan object is allowed only 25  relationship fields
if we give any rules to parent that rules automatically goes to the child.
Child does not conatin any seperate rules.
parent rules and child rules are may be same or not.
we can directly conert master-detail relationship to lookup relationshipif we cannot give a value to the lookup field then we can’t  directly conert lookup relationship
to master-detail relationship here first we need to give a value to the lookup field.
if we give a value tomaster-detail relationship field that value doesnot changed.if we give a value to lookup relationship field we can change that value whenever we required.

20. What is synchronous & asynchronous apex?

Asynchronous Apex :- 

  • Asynchronous Apex is used to run processes in a separate thread, at a later time.
  • An asynchronous process is a process or function that executes a task “in the background” without the user having to wait for the task to finish.
  • Asynchronous processes are started in a new thread, with higher governor and execution limits.

Example:
Batch
@future Annotation
Queueable Interface

synchronous Apex :- 

  • Synchronous Apex means entire Apex code is executed in one single go.
  • Synchronous execution does not wait for available resources.

Example:

Trigger
Controller Extension
Custom Controller

21. Write down the soql query of parent-child (account & contact)?

Soql query of parent-child record like that:

Select Id, Account.Name [Select Id From Contact] From Account.

22. is the finish method mandatory?

The finish method is mandatory in the apex batch class. If you don’t write Finish Method, there will be Compile Error and the Class won’t be saved at all.

23. Write down the syntax of the batch class?

Global (Database.Querylocator | Iterable<Sobject>) Start(Database.Batchablecontext Bc) {
       // Collect The Batches Of Records Or Objects To Be Passed To Execute
   }
   Global Void Execute(Database.Batchablecontext Bc, List<P> Records){
       // Process Each Batch Of Records
   }   
   Global Void Finish(Database.Batchablecontext Bc){
       // Execute Any Post-Processing Operations   
 } 

24. What is the use of the database. stateful?

When using a Database. Stateful, only instance member variables retain their values between transactions. Static member variables don’t retain their values and are reset between transactions.

25. How to call batch class from the batch?

Call another batch class from a batch class

  • Call another batch class in the finish method.
  • Using Queueable Apex

26. What is the process of execution of each method?

  • start method:
  • execute method
  • finish method

27. What are the trigger best practices?

Triggers Best Practices are:

  1. One Trigger Per Object
  2. Logic-less Triggers
  3. Context-Specific Handler Methods
  4. Bulkify your Code
  5. Avoid SOQL Queries or DML statements inside FOR Loops
  6. Avoid Hardcoding IDs

28. Write down the parent to child & child to parent query?

We Will Use Object__r.Field For Child To Parent And Select Id [Select Id From Child Object] From Parent Object

29. How to implement a list and map in a single program?

30. What are the vf pages & triggers?

Vf Pages -: Developers can use Visualforce to create a Visualforce page definition. A page definition consists of two primary elements:

  • Visualforce markup -: Visualforce markup consists of Visualforce tags, HTML, JavaScript, or any other Web-enabled code embedded within a single <apex: page> tag. The markup defines the user interface components that should be included on the page, and the way they should appear.
  • A Visualforce controller -: A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in the associated Visualforce markup, such as when a user clicks a button or link. Controllers also provide access to the data that should be displayed on a page and can modify component behavior.

Triggers -: Apex can be invoked by using triggers. Apex triggers enable you to perform custom actions before or after changes to Salesforce records, such as insertions, updates, or deletions.

A trigger is Apex code that executes before or after the following types of operations:

  • insert
  • update
  • delete
  • merge
  • upsert
  • undelete

31. What are the Standard Controller and Custom Controller?

Custom Controllers -: A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller but overrides one or more actions, such as edit, view, save, or delete. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.

Standard Controllers -: A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in the associated Visualforce markup, such as when a user clicks a button or link. Controllers also provide access to the data that should be displayed on a page and can modify component behavior.

32. What are the aura bundles?

Aura Bundles:- A bundle contains an Aura definition, such as an Aura component, and its related resources, such as a JavaScript controller. The definition can be a component, application, event, interface, or token collection.

Aura Bundles types :

  • .cmp
  • .design
  • .svg
  • .js
  • .css
  • .auradoc
  • .evt
  • .tokens

33. How to query large data sets?

If the query results return more than 1,000 records, then a SOQL query for loop must be used instead, since it can process multiple batches of records through the use of internal calls to query and query more.

34. What are the aura events?

There are two types of events in the framework:

  • Component events are handled by the component itself or a component that instantiates or contains the component.
  • Application events are handled by all components that are listening to the event. These events are essentially a traditional publish-subscribe model.

6 Responses

  1. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but other than that, this is excellent blog. A great read. I’ll definitely be back.

  2. Nice read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch because I found it for him smile Thus let me rephrase that: Thanks for lunch!

  3. I am often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark your site and keep checking for new information.

  4. It is truly a great and helpful piece of info. I’m happy that you shared this useful information with us. Please keep us informed like this. Thank you for sharing.

  5. Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between user friendliness and visual appearance. I must say you’ve done a great job with this. In addition, the blog loads extremely quick for me on Internet explorer. Exceptional Blog!

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

NetSuite Salesforce Integration: An Automation Guide

NetSuite Salesforce Integration is the seamless connection between NetSuite, a leading cloud-based Enterprise Resource Planning (ERP) system, and Salesforce, a premier Customer Relationship Management (CRM) platform.