You need to sign in to do that
Don't have an account?
TehNrd
How to replicate a "My Account Team and My Accounts" query?
When running a report and if Account Teams are enabled you have an option to search "My Account Team and My Accounts". This returns accounts in which you are listed on the sales team or you are the account owner. Belwo is the SOQL and error I am recieving:
List<Account> acc = [SELECT Id FROM account WHERE Id IN (SELECT accountId FROM accountteammember WHERE UserId = :UserInfo.getUserId()) OR ownerid = :UserInfo.getUserId()];
Error: Semi join sub-selects are not allowed with the 'OR' operator
Is this a dead end? Any ideas how this could be accomplished with SOQL....or maybe even without SOQL.
Thanks,
Jason
Jason,
I suppose you could split it into two SOQLs and do a union across them. May need to load it into a Set if you also want eliminate dups between the two lists.
All Answers
Jason,
I suppose you could split it into two SOQLs and do a union across them. May need to load it into a Set if you also want eliminate dups between the two lists.
Thats a good idea. In the second query I could probably do something like this to remove the dupes:
Yep - even better. No need for a Set etc.
Ram