You need to sign in to do that
Don't have an account?
SFDC_KM
System.UnexpectedException: commits are not allowed because someone called setCommitAllowed(false), justification: doWorkAndCommit
I am calling a batch in trigger where I am getting 'System.UnexpectedException: commits are not allowed because someone called setCommitAllowed(false), justification: doWorkAndCommit' error while bulk update. In debug logs the error is indicated for line no underlined below.
if ([SELECT count() FROM AsyncApexJob WHERE JobType='BatchApex' AND (Status = 'Processing' OR Status = 'Preparing' OR Status = 'Queued')] < 5){ ID batchprocessid = Database.executeBatch(new batchClass(contactIds),100); } else{ ID batchprocessid = Database.executeBatch(new batchClass(contactIds),100); Boolean isSuccess = System.FlexQueue.moveJobToFront(batchprocessid); system.debug('---batchprocessid: '+batchprocessid+' & movedToFront: '+isSuccess); }Can anyone lead me to the reason for this exception?