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 2 years, 11 months agoLiquad
Highly Voted 3 years, 1 month agoAvinash_14
Most Recent 1 month agotester1987
10 months, 1 week agolorenac2
1 year, 10 months agosf2022
1 year, 11 months agoAdarsh168
3 years, 8 months agorodmfpwc
3 years, 7 months agosf2022
1 year, 11 months ago