Salesforce Interview Questions

Salesforce Interview Questions – Part 1

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

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

Data Import Wizards Data 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 class?

Schedulable Class Batchable Class
To execute any class at a specific time we use the scheduling apex It divides the whole process into batches (each batch handles 200 records at a time).
first needs to implement the Schedulable interface for the class First need to implement the Salesforce-provided interface Database.Batchable
The Schedulable interface contains one method that must be implemented, execute The 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 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.

Batch Apex
Apex Transaction Limits
Apex Transaction Limits

6. What is the difference between SOQL and SOSL?

SOQL(Salesforce Object Query Language) SOSL(Salesforce object Search Language)
Using SOQL we can Search only on one object at a time. Using SOSL we can search on many objects at a time.
We can query on all fields of any data type We can query only on fields whose data type is text,phone and Email.
We can use SOQL in Triggers and classes. We can use in calsses but not in Triggers.
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
    }
}

dont miss out iconDon't forget to check out: Fair Interview Conversation with Certified Salesforce Business Analyst

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. Auto launched 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 update.
  • 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 record?

@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 is the difference b/w queueable and future?

Future Method Queueable 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

components

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

dont miss out iconCheck out another amazing blog by Aman Garg here: Knowledge of Salesforce User Licenses and its Types

18. What are relationships in Salesforce?

A Relationship is a way in which two or more people or things are 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 Relationship Lookup Relationship
in master-detail relationship field value is mandatory in lookup relationship field value is not mandatory
If parent record is deleted automatically child records is deleted If parent record is deleted automatically child records are not deleted
an object is allowed only 2 master-detail relationship fields an 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 relationship if 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:
Trigger
Controller Extension
Custom Controller

Synchronous Apex:-

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

Example:
Batch
@future Annotation
Queueable Interface

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?

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

23. Write down the syntax of 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 database. stateful?

When using 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 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 is 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 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 behaviour.

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 override 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 querying 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 queryMore.

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.

Responses

Popular Salesforce Blogs