New answers tagged


I wouldn't say this trigger is production ready. Couple of things I can recommend are. Move the SOQL and DML outside for loop. Add error handling for SOQL and update. Do not write logic inside triggers. Read this document and enterprise architecture book if you have some time. Add comments about the functionality.(Personal choice)


No, you have not properly bulkified your code. Bulkification 101's most important lesson is to aggregate filter values, query before your loop and put records into a Map, and update values after your loop. Set<Id> sponsorshipIds = new Set<Id>(); for (Opportunity record : { sponsorshipIds .add(record.Sponsorship_Contract__c); } ...

Top 50 recent answers are included