You need to sign in to do that
Don't have an account?
sslater
using profile.permission* in where clause
I was trying to make a soql call like:
Select u.Email, u.Id, u.Name, u.ProfileId, u.Profile.Name, u.Profile.PermissionsViewAllData from User u where u.Profile.PermissionsViewAllData = true
and it gave me an error saying that I cannot use the Permissions* in a where clause.
Does anyone know why and/or if you can work-around this? Seems kinda silly. I know I can just query for everything and then handle it in apex, but that's not as clean.
Thanks!
Salesforce does not let you filter on Profile.PermissionsViewAllData. I would use this instead: //assuming I understand your requirements...
list<profile> ps = new list<profile>();
list<user> us = new list<user>();
ps = [Select Name, PermissionsViewAllData, (select user.id from Profile.Users) from Profile];
for(profile p : ps){
if(p.PermissionsViewAllData==true){
list<user> users = p.users;
if(us.size()!=0){}//do something with list
}
}