01 | private static Set<ID> getAllSubRoleIds(Set<ID> roleIds) { |
02 |
03 | Set<ID> currentRoleIds = new Set<ID>(); |
04 |
05 | // get all of the roles underneath the passed roles |
06 | for(UserRole userRole :[select Id from UserRole where ParentRoleId |
07 | IN :roleIds AND ParentRoleID != null]) { |
08 | currentRoleIds.add(userRole.Id); |
09 | } |
10 |
11 | // go fetch some more rolls! |
12 | if(currentRoleIds.size() > 0) { |
13 | currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds)); |
14 | } |
15 |
16 | return currentRoleIds; |
17 | } |
參考網址:https://developer.salesforce.com/forums/?id=906F0000000DCTFIA4
沒有留言:
張貼留言