You need to sign in to do that
Don't have an account?
B2000
UserRole Heirarchy
I need to query all opportunities for a user and their subordinates in the UserRole heirarchy. I currently create a set of UserRole Ids from all the UserRole records to do the query. I wasn't sure if their is another way to accomplish this. Any recommendations?
Thanks.
Hi Brian,
I'd have thought that if your class has 'with sharing' in the class then you would only get back opportunities the user is allowed to see according to the sharing rules if the sharing is setup correctly (ie. role hierarchy applied) .
If the sharing model doens't work for you then your function of getting the role hierarchy and creating your own select statement is the easiest way to go. Problems may occurr furter down the line if groups/queue functionality is implemented....
Cheers,
Rich
Richie D. thanks for you response. I thought so too, so I created a test class using 3 different users in the heirarchy. The test class returns 8710 records for all 3 users. I created a report with identical criteria, it returned 8710, 5043, and 197 records when using the heirarchy.