Activity Forums Salesforce® Discussions How can we get the userinfo in batch in Salesforce?

  • PRANAV

    Member
    September 23, 2016 at 6:15 am

    Hi Mohit,

    You can use UserInfo Class methods for this.

    Like: UserInfo.getUserId();
    UserInfo.getUserEmail();

    Note, this will get information for the user that scheduled the Job in the first place which may/may not be what you need.

    If you needed the same details for say a record owner, you would need to access that from the User object (using the OwnerId field as a lookup to User) within the execute() method itself.

    Hope this helps you.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos