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
sriram k 15sriram k 15 

Want to fetch all Opportunity Records created by current User Today?

I am getting error with this Query. Can Anyone help to fetch details?

Select Id,Name,Amount from Opportunity where createdDate = Today AND CreatedById = UserInfo.getUserId()

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sriram,

UserInfo.getUserId() can be used only in the APEX class with standard controller and it is not a method. You should use it as below.
[Select Id,Name,Email from User where Id=:userinfo.getuserId()];

If this solution helps, Please mark it as best answer.