I’ve had it a number of times when trying to update parameters on batch job tasks that I’ve received the cryptic message “Cannot edit a record in Batch transactions (Batch). The corresponding AOS validation failed.” Due to laziness or business I’ve always dismissed the problem and found a work around, but never fully tried to understand why this message occurs.
I’ve finally had the opportunity to drill into it and decided to share what I found.
Firstly: The message is generated because of the value “false” being returned from the overwritten method “aosValidateUpdate” on table “Batch”, this explains the text of the message “AOS validation failed”, but not the business logic reasons. Drilling into this method one can see the following business logic for allowing updates of batch tasks
1. The user doing the update must either be the person who created the record (createdBy field) or a person with access to the Display MenuItem “BatchJob” (see Batch->IsBatchOperator). (This does work for administrators who don’t have explicit access).
2. Batch tasks may not change the company, dataPartition or batchJobId. (This is unlikely to happen as they are disable from forms anyway)
3. If the user doing the update is NOT the person who created the job then the parameters and Class of the task cannot be changed – this is the primary reason why we were experiencing the issue.
Notes: I’m not sure why the rule around changing the parameters exists, but it does, so if you want to change this then you would need to either login as the creator and change the parameters, or modify via SQL the batch task to run under your user in the case of historical batch jobs where the user does not exist.