You need to sign in to do that
Don't have an account?
Iswarya Sekar
how to bulkify this code? Please help me!!
public class UpdateUser { Public static void method1(List<case> caseList){ set<id> parentcaseId = new set<Id>(); for(case cs:caseList){ if(cs.Defect__c != null){ parentcaseId.add(cs.Defect__c); } } List<Case> caseslistold = [SELECT Id, OwnerId FROM Case WHERE Id in : parentcaseId]; for(Id csIdtoUpdate:parentcaseId){ for(Case cas:caseslistold){ for(case cs:caseList){ cs.Product_Lead__c=cas.ownerId; } } } } }
trigger updateUsertrig on Case (before insert, before Update) { if((trigger.isInsert && trigger.isBefore) || (trigger.isUpdate && trigger.isBefore)) UpdateUser.method1(trigger.new); }
You can try below code and let me know if that work for you.
--
Thanks,
Prashant
--
Thanks,
Prashant
Let us know if this will help you