You need to sign in to do that
Don't have an account?
G2WIntegration
CronTrigger can be inserted by read only user but not deleted - insufficient privileges error
This smells like a bug:
1) Create button that inserts cron triggers
2) Create button that aborts these same cron triggers
3) Have standard or read only (non-admin) user click the button
4) Have that same user click button to delete crontriggers
Expected:
Same permissions apply to #3 & #4
Actual:
User can insert, but gets Insufficient Privileges error on abort
Is there any way to drop into system mode for these users? Everything works fine with admins.
Insert code sample:
system.schedule('Get Webinars', getWebinarsSchedulerStartTime, new g2wGetWebinarsSchedulerExecute()); system.schedule('Get Registrants', getRegistrantsSchedulerStartTime, new g2wGetRegistrantsSchedulerExecute()); system.schedule('Get Registrant Details', getRegistrantDetailsSchedulerStartTime, new g2wGetRegistrantDetailsSchedulerExecute()); system.schedule('Get Sessions', getSessionsSchedulerStartTime, new g2wGetSessionsSchedulerExecute()); system.schedule('Get Webinar Attendees', getAttendeesSchedulerStartTime, new g2wGetWebinarAttendeesSchedulerExecute());
Abort code sample:
List<CronTrigger> cts=[SELECT Id, NextFireTime, State FROM CronTrigger WHERE (CronExpression =: g2wUtils.getWebinarsSchedulerStartTime OR CronExpression =:g2wUtils.getRegistrantsSchedulerStartTime OR CronExpression =:g2wUtils.getSessionsSchedulerStartTime OR CronExpression =: g2wUtils.getRegistrantDetailsSchedulerStartTime OR CronExpression =: g2wUtils.getAttendeesSchedulerStartTime) AND State != 'DELETED']; if (cts.size()>0){ for(CronTrigger ct:cts){ system.abortJob(ct.Id ); }//for 1 }//if 1
Update - pretty silly, but "Modify All Data" is required to abort a job, but not needed to insert it. Seems like a bug.