You need to sign in to do that
Don't have an account?
Mohd Nabeel
IN operator must be used with an iterable expression.. What should i do in this..
trigger BillingAddressMod on Account (after update) { public static boolean flag=true; If(flag==true) { account acc = [select id, BillingPostalCode from account where id in : trigger.new]; List<contact> contList = [Select id, MailingPostalCode from Contact]; Set <Id> setContact = new Set<id>(); for(Contact cont: contList){ setContact.add(cont.MailingPostalCode); } Map<id,Contact> mapAccount = [Select MailingPostalCode from Contact where AccountId in: acc]; for (contact con : contList) { if(acc.BillingPostalCode != con.MailingPostalCode) { contList.add(con); } } If(contList.size()>=1) { acc.OutofZip__c = true; } flag=false; update acc; } }
All Answers
I have gone through your code. (In) Operator can only be used with lists while in your code in line number 10,
you are using (In) operator with a single account object(acc).
You should either use (=) instead of (In) or convert acc object into a list of account objects.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
I'm not really sure what you are trying to do here but I gave it a go changing your code to something that might work for you
Please mark this as the correct answer if you were able to do what you where planning with this code
please mark my answer as the correct answer for future reference