Skip to main content
3 of 3
corrected v rule formula
Thomas Taylor
  • 5.9k
  • 25
  • 45

Validation rule Scheduled Apex

I have a scheduled apex job which updates a field which is controlled by a validation rule as follows:

AND(
    Not(ISNEW()), 
    $Profile.Name != "System Administrator",
    ISCHANGED(theFieldInQuestion)
)

This validation rule prevents anyone from changing the value in theFieldInQuestion UNLESS that person is a System Administrator.

The scheduler runs as system, according to the documentation located here:

https://help.salesforce.com/articleView?id=code_schedule_batch_apex.htm&type=0

My question is : What can I add to this AND clause in the validation rule which would allow the Scheduled Apex Job to update theFieldInQuestion ?