New Batch#100 (10th Nov 2021) - Salesforce Admin + Dev Training (WhatsApp: +91 - 8087988044) :https://t.co/p4F3oeQagK

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