You need to sign in to do that
Don't have an account?

How can I match a field of parent in child records in a apex trigger
I created a trigger on case. Member_ID__c is a auto-number field on contact object. I am trying to find out repeat cases logged by a contact using custom checkbox Repeat_Caller__c on case. There are many other conditions, but I removed them in this code for simplicity. I am not able to match Member_ID__c field in cases even though multiple cases are created by the same contact. In other words, I am not able to enter the IF condition. I have pasted the trigger below.
Please guide me as to where the problem might be. Any help is appreciated.
Please guide me as to where the problem might be. Any help is appreciated.
trigger repeatCase1 on Case (before insert,before update) { List<Case> caseList = trigger.new; Set<id> memberIdSet = new set<id>(); for(case c: caseList){ memberIdSet.add(c.Contact.Member_ID__c); } List<Case> allcase = [select Contact.Member_ID__c from case where contact.Member_ID__c IN: memberIdSet]; for(Case cs: caseList ){ for(Case all: allcase ){ if(cs.contact.Member_ID__c == all.contact.Member_ID__c ){ cs.Repeat_Caller__c=True; } } } }
All Answers
In order to obey governor limits, how can I use map instead of inner for loop in this case?
Do you want to get FREE psn codes for your Playstation? free psn codes 2019 (https://freepsncodes2019.com/)
shared because it provided a lot of knowledge about PUBG NEWS (https://www.pubgnews.website/" target="_blank)
thanks https://froont.com/cmadroit/cmadroit-all-about-coin-master