logo

Courses

Home

Self Paced Courses

Others

Login

20 Salesforce Trigger Interview Questions with Real-Time Scenarios

Categories:N/A

Last Update:29 October 2026

Publish Date:25 February 2026

Author

Written by

Admin

Author

Admin

Author

Reviewed by

Srijan Institute Editorial Team

Author

Srijan Institute Editorial Team

Expert Review Team

This content has been carefully reviewed by the Srijan Institute Editorial Team to ensure accuracy, clarity, and consistency with our editorial standards. Our team evaluates key information and supporting details before publication to provide readers with reliable and relevant content.

✓

Expert Verified

This blog covers 20 essential Salesforce Trigger interview questions with real-time scenarios to help you prepare effectively. It includes practical examples, common use cases, and expert-level explanations for both freshers and experienced professionals.A complete guide to confidently crack Salesforce interviews.

20 Salesforce Trigger Interview Questions with Real-Time Scenarios

What if a Salesforce trigger is successful on one record but fails when 200 records are inserted at once? This practical task can make a difference real quick. Typical Salesforce Trigger interview questions involve recursion, Flow, SOQL, DML, Governor Limits, bulk processing, and common project mistakes.

The interviewers are looking for answers on whether you can write secure, scalable, bulk safe Apex code in a Salesforce live environment. In this blog, you will learn 20 Salesforce Trigger Interview Questions and Answers, with examples, with scenarios. They will also assist with more general Salesforce Developer interview questions and coding scenarios.

What Is a Salesforce Trigger?

A Salesforce Trigger is Apex code that runs by itself when a record changes. For example, you can use a trigger when a record is:

  • Added

  • Changed

  • Deleted

  • Restored

The trigger can be executed before and after the record update. The Before Trigger is executed before the Salesforce updates the record and can be used for the validation of data and changing the field before updating it. An After Trigger runs after Salesforce saves the record. You can use it when you need the record ID or need to work with other records.

There is one small detail to remember. An after trigger does not mean the whole transaction is finished. It still runs as part of the same transaction.

Top 20 Salesforce Trigger Interview Questions by Experience Level

These Salesforce Trigger Interview Questions and Answers start with the basics. Then they move to harder topics and examples.

If you are new to Salesforce, start here. Learn what a trigger does first. Then learn when to use each trigger type.

Salesforce Trigger Interview Questions for Freshers and Beginners

Q1. What Trigger Events are available in Salesforce?

A. Salesforce has seven trigger events:

  • before insert

  • before update

  • before delete

  • after insert

  • after update

  • after delete

  • after undelete

Each event occurs at a certain point. For instance, you may use before insert if you want to alter data before the insertion of a record. You can use after undelete when a deleted record is restored.

Q2. What Are Trigger.new and Trigger.old?

A. Trigger.new gives you the new record values. Trigger.old gives you the old record values. You can use it during update and delete events. Here is a simple example. An Opportunity changes from Prospecting to Closed Won. you can compare the old Stage with the new Stage. This tells me that the Stage changed.

Interview Questions on Salesforce Triggers for Advanced Level

Q3. What Is Trigger Bulkification, and Why Does It Matter?

A. Trigger Bulkification refers to writing code such that Apex code will be able to process multiple records at once. A trigger may get one record. It may also get 200 records. Your code should work well in both cases. You avoid running SOQL or DML again and again. That can cause Governor Limit errors.

For example, you can collect all Account IDs from Contacts first. Then you run one SOQL query to get the Accounts. You can store them in a Map. Then you process the records and run DML.

The basic flow is simple:

Collect → Query → Process → DML

Q4. How do you prevent trigger recursion?

A. Recursion is triggered when your trigger is fired again by another update that initiated it. Before running the logic, see what changed, and only perform the logic when there is a change that requires action.

An example of this is the ability to have your logic executed when the Stage transitions to Closed Won when the Opportunity is moved to Closed Won. If any other field changes, the same logic does not have to be executed.

You can also know whether the action has occurred or not. This helps stop the same work from running twice. A static Boolean can help in some cases. But you would not use it for every recursion problem.

Q5. What are Salesforce Governor Limits?

A. Governor Limits are limits set by Salesforce. They control how many system resources your Apex code can use in one transaction. These limits apply to things like SOQL queries, DML statements, CPU time and other Salesforce resources.

For example, you should not put a SOQL query inside a loop. Why? If your trigger gets many records, the query may run many times. This can hit a Governor Limit and cause an error.

Q6. What is a Trigger Handler class?

A. A Trigger Handler class keeps the main business logic outside the trigger.

This keeps my trigger small and easy to read. For example, your trigger can detect an Account update. It then calls a handler class. The handler checks the rules and does the required work. This also makes my code easier to test and maintain.

Q7. How does Salesforce Order of Execution affect trigger design?

A. Salesforce follows a set order when it saves and updates a record. A trigger is only one part of this process. Other automation can also run. For example, a Flow may update a record. That update can cause Apex trigger code to run again. Failure to consider these will lead to you experiencing Extra updates, Trigger recursion, Duplicate work and Validation errors.

Salesforce Trigger Interview Questions for Experienced Developers & Consultants

Salesforce Trigger Interview Questions For Experienced Developers focuses on real project problems, automation, bulk data and performance.

Q8. How would you design a trigger for thousands of incoming records?

A. You should make the trigger bulk safe. This means it can handle many records at once. If some work can wait, you can use Queueable Apex. This moves that work out of the main transaction.

Q9. How do you choose between Flow, Trigger, Queueable Apex, and Platform Events?

A. You first look at what the business needs. Then you pick the right tool. Flow can work well for simple record changes. Apex Triggers can handle more complex code. Queueable Apex can run work later. The Platform Events feature may trigger an event elsewhere within the system.

If you need just to update a field, then the Flow tool can be used. If there is complex code, then Apex would be a choice. This decision also depends on the size of the data, speed, etc.

Q10. How do you handle errors without failing unrelated records?

A. You first ask one simple question. Are all records guaranteed to be successful, or can some records fail?

If all records are required to be processed, then you can perform normal DML and let the transaction roll back if necessary. If some records can fail, you can employ Database methods. These are techniques I can use to review every record following the DML.

For example, you may have 100 records. Three do not have good data. The other 97 records may still be saved if the business permits.

Q11. What are ways to improve a trigger that has too many SOQL queries and DML statements?

The first place to look is for SOQL and DML in loops. This is usually the issue. For instance, you can have 100 Contacts. Each Contact has an Account.

Never make a hundred calls to query the Account.

Rather, you would be storing the Account IDs within a Set. If you would then you would run one SOQL query. The results can be stored in a Map and will be available later. So you would do the same for DML. You would first gather the records. If so, then you would insert or update them all at once.

Salesforce Trigger Interview Questions Asked in Live Coding Rounds

Q12. Write a trigger to prevent duplicates based on a field.

A. First, you would check if Salesforce can stop the duplicate by itself. You may use a Unique Field or a Duplicate Rule. If you need Apex, you should check for two types of duplicates. you would check old records. you would also check the new records in the same request.

For example, two Leads may come in with the same email. You need to catch both Leads. A check against old records alone may not catch this.

Q13. Write a Bulkified trigger that updates a related parent.

A. First, you should collect the parent IDs in a Set. Then, get the parent records with one SOQL query. Next, make the changes in memory. Lastly, use a single DML statement to insert the parent objects. For instance, there could be 200 Contacts associated with 30 Accounts. You should update the 30 Accounts. You should not run 200 DML statements.

Q14. How do you create related child records when a parent is inserted?

A. You should use an after-insert trigger when you need the new parent ID. Create the child records in a List. Then, insert all of them at once.

For example, you create a new Account. The trigger can create a default Contact for that Account. Simple. But there is one rule to remember. Do not put DML inside a loop.

Q15. How would you stop a trigger from updating the same records again and again?

A. First, check if the record really changed. Then, run the action only when that change happens.

For example, you may need to create follow-up work when an Opportunity changes to Closed Won. The Opportunity may be updated again later. That update should not create the same work again.

Q16. What is the difference between update and Database. update()?

A. Update uses all-or-none behavior. If one record fails, the whole DML operation can fail. Database. update() can allow partial success when I use allOrNone = false. For example, if you update 100 records and 3 have errors, Database. update(records, false) can save the other 97 records.

Salesforce Trigger Scenario Based Questions: Production Scenarios 

These Salesforce Trigger Scenario Based Questions cover real production situations you may face in a Salesforce org. 

Q17. How do you prevent trigger recursion?

A. First check if the record or field has really changed. If nothing changes, do not run the code again. This helps stop the trigger from running again and again. You can also use a static variable to control the trigger and stop the same code from running many times in one transaction.

Q18. How do you choose between Flow, Trigger, Queueable Apex, and Platform Events?

A. You should first check what the task needs. Use Flow for simple automation then use an Apex Trigger when you need more complex code. Use Queueable Apex when the work can run later. You can use Platform Events when two systems or processes need to share events.

Q19. How would you design a trigger for thousands of incoming records?

A. You should make the trigger bulkified from the start. Collect record IDs in a Set and run the SOQL query once. You should not run a query for every record. Then, process the records in memory and use bulk DML to save them. If some work can wait, use Queueable Apex for that part.

Q20. How do you handle errors without failing unrelated records?

A. First check if all records must be saved or if some can fail. If all records must work, use normal DML. If some records can fail, you can use Database methods with allOrNone = false. This lets Salesforce save the records that work while the failed records return errors. You can then check those errors and handle them as needed.

Coding & Real-Time Scenarios

Apex Trigger questions can be about real work. The interviewer can provide you with an issue that needs to be addressed.

The algorithm should work with single as well as multiple records. It should also stay within Salesforce limits.

Q1. How would you update related records without SOQL or DML inside a loop?

You can use this simple flow as this keeps the trigger bulk-safe. It also helps avoid Salesforce Governor Limits.

Step

What to do

1

Get the record IDs

2

Run SOQL once

3

Store records in a Map

4

Make the changes

5

Run DML after the loop

Q2. How would you make an external callout after a record change?

Don’t make the callout in the trigger itself. Make an asynchronous callout via an asynchronous apex like Queueable Apex.

The basic flow here is – Record Change -> Trigger -> Queueable Apex -> Callout

In this case, the trigger will pass on the necessary information to the queue which will then initiate the callout process. In case the callout fails, you should be able to catch the exception.

Q3. How would you prevent duplicate records in a trigger?

First, see if Salesforce can do the job. You can use:

  • Unique Field to stop the same value from being used twice.

  • Duplicate Rule to find possible duplicate records.

If Apex is needed, check two things:

  1. Check records that are already in Salesforce.

  2. Check the new records in the same trigger batch.

This helps stop duplicate records before they are created.

Q4. What would you check if a trigger works for one record but fails during bulk processing?

Start with these checks:

  • Look for SOQL inside a loop.

  • Look for DML inside a loop.

  • Check if the code works only with one record.

  • Check for repeated work.

  • Ensure that the code is capable of handling bulk records.

While dealing with bulk records, make use of sets, lists, and maps. Now, it is necessary for you to test the trigger in a bulk way instead of a single record.

Q5. How would you debug a Flow and Trigger both updating the same record?

Firstly, the Order of Execution should be considered. And then it should be checked which one of them is executed first.

Look for:

  • Repeated updates,

  • Recursion,

  • Doing the same work twice,

  • Flow and triggers that change the same field.

If both do the same job, try to consolidate it in one place wherever possible. This might help avoid repetitions and errors.

Things Interviewers Commonly Test

When you study Apex Trigger interview questions, start with the basics. But interviewers may ask more. They may ask what happens when many records change at once.

They may ask what happens when an error occurs. They may also ask what happens when Salesforce hits a limit. So, learn how triggers work in real cases. Not just what they mean.

Area

What You Should Know

Trigger Events

Know when to use before and after triggers.

Context Variables

Know how Trigger.new and Trigger.old work.

Bulkification

Know how to make a trigger work with many records at once.

Governor Limits

Know how to avoid too many SOQL queries, DML actions, and CPU use.

Recursion

Know why a trigger can run again. Know how to stop extra runs.

Order of Execution

Know how a trigger works with other Salesforce automation.

Trigger Structure

Know how to keep your trigger code clean and easy to read.

Error Handling

Know what happens when a record or transaction fails.

Asynchronous Apex

Know when some work should run later, outside the main transaction.

Testing

Know how to test one record and many records. Test both success and error cases.

Wrapping Up

Before your interview, start with the main Salesforce Trigger Interview Questions. Learn how triggers work in real projects. You should know context variables, Bulkification, Governor Limits, recursion, Trigger Handlers, Order of Execution, and Flow vs. Apex.

If you’re exploring Salesforce as a career option, please check out our Salesforce Online Courses Program from Srijan Institute for more info on learning SAP Skills and your certification options. Ready to test your Salesforce Trigger skills? Start with the questions above. Practice often. Keep your answers clear and simple.

FAQs

Q1. What are the most common Salesforce Trigger Interview Questions topics?

Ans: Most common topics are Trigger Events, Context Variables,Bulkification, Governor Limits, Recursion, Trigger Handlers and Order Of Execution.

Q2. What Salesforce Trigger interview question asked in Coding Interviews?

Ans: The coding rounds will generally ask for writing Bulkified triggers, preventing duplicates, updating related records, creating child records etc.

Q3. What Salesforce Trigger Questions asked to experienced developers?

Ans: Experienced candidates would be asked for Recursion, Automation Conflicts, Performance, Error Handling, Asynchronous Apex & Large Data Volumes.

Q4. How to prepare for Salesforce Trigger Interview Questions?

Ans: You can learn trigger concepts, practice Apex coding, and prepare for various real-time scenarios like handling bulk data, governor limits, and automation.

Q5. What are Real-Time Scenarios asked in Salesforce Trigger Interviews?

Ans: Common examples include trigger recursion, Mixed DML Errors, UNABLE_TO_LOCK_ROW, Flow vs. Apex issues, Duplicate Records, and more when working with bulk processing.

Table of Content

+

Ready to Upgrade Your Skills?

Connect with us today and find the right course for your goals.

Request a Callback

+91-8860051051

info@srijaninstitute.com

+91 9217098512

Request a Callback
Phone

Request a Callback

Call Now

logo

Empowering the next generation of industry leaders through practical skills and real-world exposure.

Quick Links

About us

Contact us

Blog

Pay fee

Corporate Training

Hire From Us

Verify Certificate

Subscribe

Stay updated with latest trends & events.

Quick Links

+

Courses

+

Popular SAP Courses

+

Popular Oracle Courses

+

Popular Workday Courses

+

Legal & Accessibility

+

Popular SAP Courses

DISCLAIMER - THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

Copyright © 2026 a unit of DIGIVIBRANT TECHSOLUTIONS PRIVATE LIMITED. All Rights Reserved