Ads

Sunday 26 May 2013

How To retrieve the records of the custom/standard object of the current user?

Solution:

Id aid = Userinfo.getUserId();
account ac = [Select Id, Name from Account Where CreatedById = : aid limit 1];
System.debug(' ---- ' + ac );

or

Id aid = Userinfo.getUserId();
List<Account> ac = [Select Id, Name From Account Where CreatedById = : aid Limit 10000];  


No comments:

Post a Comment