A developer writes the following Apex trigger so that when a Case is closed, a single Survey record is created for that Case. The issue is that multiple Survey_c records are being created per Case. trigger CaseTrigger on Case (after insert, after update){ List<Survey_c> createSurveys = new List<Survey_c>(); for (Case c : trigger.new){ if (c.IsClosed && (trigger.isInsert II trigger.isUpdate && trigger.oldMap.get(c.Id).IsClosed == false)){ createSurveys.add(new Survey_c(Case_c = c.Id)); } } insert createSurveys; }
What could be the cause of this issue?
Sri_Vathsa
Highly Voted 3 years, 7 months agoLiquad
Highly Voted 3 years, 10 months agoAvinash_14
Most Recent 9 months, 1 week agotester1987
1 year, 6 months agolorenac2
2 years, 6 months agosf2022
2 years, 7 months agoAdarsh168
4 years, 4 months agorodmfpwc
4 years, 3 months agosf2022
2 years, 7 months ago