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
vanessa veronvanessa veron 

Field is not writeable: CronTrigger

Hello,

I'm trying to do the upgrade of the PreviousFireTime field into CronTrigger, but I try an error:

Error: Compile Error: Field is not writeable: CronTrigger.CronExpression
LINE: ct.PreviousFireTime = VariablePreviousExec;

Why?

....

 CronTrigger[] acctsList = [SELECT PreviousFireTime FROM CronTrigger where CronJobDetail.Name =: VariableName ];
        for (CronTrigger ct : acctsList) {
            ct.PreviousFireTime = VariablePreviousExec;
        }
        
        try {
            upsert acctsList;
        } catch (DmlException e) {
            // code...
        }

.....

Thank you!!!
Best Answer chosen by vanessa veron
bob_buzzardbob_buzzard
If a field isn't writable, that means the database is enforcing readonly, so there's nothing you can do about that.

All Answers

bob_buzzardbob_buzzard
If a field isn't writable, that means the database is enforcing readonly, so there's nothing you can do about that.
This was selected as the best answer
vanessa veronvanessa veron
Thank you!!!