You need to sign in to do that
Don't have an account?
Trigger limits
Hi,
I am trying to be mindful of trigger limits but I am having difficulty getting something working.
I am creating a list of the Territory Zip recs I need and then I need to find all accounts with that ip code.. The Territory list is fine. How can I build the account list without putting it into the for loop? Below is what I am trying for Accoint and neither seems to be correct.
set<ID> ids = Trigger.oldMap.keyset();
list<Territory_Zip_Code__c> tzcRecs = [SELECT Id, Name, GroupId__c FROM Territory_Zip_Code__c WHEREID in :ids];
//list<Account> AccountZipRecs = [SELECT id, BillingPostalCode FROM Account WHERE BillingPostalCode in :tzcRecs.Name ];
list<Account> AccountZipRecs = [SELECT id, BillingPostalCode FROMAccountWHERE BillingPostalCode in tzcRecs.Name ];
Any help appreciated,
Sorry, I tried to clean up open requests and missed this one. I did get things working thank you for help.
All Answers
a joint query will work here.
I'm not much familiar with fields of your object, so i suggest to try this:
If it runs correctly, it will give you all the desired accounts.
Hope it helps.
Thanks, I tried that but get the following error:
semi join sub selects can only query id fields, cannot use: 'Name'
so not sure how to get around this,
Ohh, it seems there's no relation between Account and Territory_Zip_Code__c, right?
It would be helpful for us to help us, if you post whole trigger.
Sorry, I tried to clean up open requests and missed this one. I did get things working thank you for help.