function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SS KarthickSS Karthick 

Soql Governor Limit

Hi Everybody,
    Can anyone tell me the folllowing code reach governor limit if my org has 400 user and each user manager is next user..
example
user1----->user2(manager of user1)---->user(manager of user2)------>user3(manager of user3)........---->user400(manager of user 399)

Code Is:
public static List<Id> getAll(List<Id> ids){
List<Id> mIds = new List<Id>();
for(user u : [select ManagerId from user where id in:ids and ManagerId!=null])
  mIds.add(u.ManagerId); 
 if(mIds.size()>0)
    mIds.addAll(getAll(mIds));
return mIds;
}
If it hits then how to avoid??

Please Help!
Best Answer chosen by SS Karthick
Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
Try running this code in developer console. You will get the answer if it hits governer limmit or not :)

All Answers

Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
Try running this code in developer console. You will get the answer if it hits governer limmit or not :)
This was selected as the best answer
Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
Its always better to try things to check what happens to the code when you are the owner of code

Thanks.