FavoriteSuhas GB (IT) asked in #ApexMar 3, 2017, 9:35 AMWhen to use before insert, before update, after insert and after update in Triggers ? I would like to know in which scenario what to use, since I'm getting confused to use them. Please explain it with an example, so there could be clarity on these.5 answersSortSort by Most HelpfulSort by Most HelpfulSort by DateAmit Chaudhary (ApexHours)Dec 1, 2017, 2:14 PMUpdate code like belowtrigger setProbabilityDefaultOnOpportunities on Opportunity (before insert, before update) { for (Opportunity opp : trigger.new) { if (opp.probability == NULL ){ opp.Probability = 10; } }} Load more comments...Write an answer...BoldItalicUnderlineStrikethroughBulleted ListNumbered ListAdd linkCode blockInsert imageAttach filesLink URLCancelSave0/9000Reply
Amit Chaudhary (ApexHours)Dec 1, 2017, 2:14 PMUpdate code like belowtrigger setProbabilityDefaultOnOpportunities on Opportunity (before insert, before update) { for (Opportunity opp : trigger.new) { if (opp.probability == NULL ){ opp.Probability = 10; } }}