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
SannnSannn 

How to run a scheduler as a User

Hello Gurus,

 

I want to run the schedular class as a specific user rather than System.

Is it possible?

Any clues or samples or suggestions.

 

Thanks,

San

bob_buzzardbob_buzzard

You can't do this I'm afraid - the docs are explicit about this:

 

--- snip ---

 

The scheduler runs as system—all classes are executed, whether or not the user has permission to execute the class.

 

--- snip ---

 

Is there a particular reason why you want to run as a user?  Is it for record ownership?

SannnSannn

Dear Bob,

 

What i was trying to acheive is this 

http://boards.developerforce.com/t5/Apex-Code-Development/Please-Help-Reports-attachments-in-email-are-blank/td-p/619863

 

But due to some reason , i am getting a blank email if the System is sending the mail and in another instance when i run the method in a cconstructor i am getting the correct email i.e its perfect , so i thought that i needed to schedule it to run as a user.

 

Any pointers or suggestions from your end :) i would really be pleased .

 

Thank You very much 

San

bob_buzzardbob_buzzard

According to the docs, you can't extract the content of a page in scheduled apex.