Thursday, 16 August 2012

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

I want to retrieve the records of the custom/standard object of the current user, How?
Solution:
Id aid = Userinfo.getUserId();
account ac = [Select Id, Name from Account Where CreatedById = : aid limit 1];
System.debug(' ---- ' + ac );
Id aid = Userinfo.getUserId();
List<Account> ac = [Select Id, Name From Account Where CreatedById = : aid Limit 10000]; 

No comments:

Post a Comment

Labels