Trigger Most Common Interview Questions and Answers for MNCs and Small-Mid Companies
*** Trigger Most Common Interview Questions and Answers for MNCs and Small-Mid Companies ***
How is Trigger. New Different from Trigger.newMap?
Ans:- Trigger. New variable returns the list of sObject which has invoked the trigger and Trigger.NewMap returns the map of ids with the newly entered records. NewMap is only available in after insert, before and after the update and after undelete.
Difference between Trigger.new different from Trigger.old?
Ans:- Trigger. New variable returns the list of sObject which has invoked the trigger and Trigger.old returns a list of the older versions of the records which have invoked the trigger. Trigger.Old is only available in update and deletes events
What is a Trigger?
Ans: Trigger ๐⇍ Click This Link
What is Trigger Syntax?
What are the various event on which a trigger can fire?
What are the different type of Triggers?
What are the considerations while implementing the Triggers?
What are context variables in triggers?
Can a trigger call a batch class?
Ans:- Yes, we can call a batch class in the trigger as we do in the normal apex code.
Can a trigger make a call to Apex callout method?
Ans:- we can call a callout method in Apex Trigger but the only condition is that it has to be an asynchronous callout because the trigger flow cannot wait on the response received by the callout method.
Define Recursive Trigger and how to avoid it?
Ans:- There is a possibility that the result of the trigger can end up calling the same trigger again and can run in a loop, this is known as a recursive trigger. To avoid this scenario we should create a static variable and check the value of this variable before we execute anything in the trigger.
Write a trigger that updates a contact when an account updates?
Write a trigger that inserts a new contact?
Write a trigger that upsert a contact when an account updates?
Ans:- Upsert Trigger ๐⇍ Click This Link
Comments
Post a Comment