Time Based Workflows not actioning correctly - end user receiving email "Salesforce.com workflow could not perform a pending action"
|Knowledge Article Number||000199607|
Sometimes when a time-based workflow rule cannot carry out a workflow action for some reason, the administrator will receive an email along the lines of:
Salesforce workflow could not perform a pending action
Object Type: xxx
Workflow Rules attempted: xxx
Workflow Actions attempted: xxx
Error Number: xxxxxxxx-xxxxxx (xxxxxxxxxx)
This can be tricky to troubleshoot as the email does not give any specific reason behind the action not occurring.
Typically this error means that there is some apex that would function incorrectly, or some limit that would be breached if the action was carried out.
To troubleshoot this issue we need to understand what happens with workflow actions. Now when you go to save a record that will trigger an immediate workflow action with a field update the Apex triggers are all run again, meaning that when you attempt to save the record if there are any potential apex issues you will immediately receive an error and will not be able to save the record. The error however will give the reasons behind this, and you can immediately troubleshoot, an example being:
"execution of BeforeUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.:"
With Time-based workflow saving the record does not immediately carry out the update, and so the error is not received. The update can happen some time after the triggering of the workflow, and as it is automated, there is no user interface to pass this message to the user. As such a standard email is sent explaining simply that a workflow action could not occur. This may also happen when a time-based field update violates a validation rule.
To work around this the suggested fix is to temporarily modify the workflow rule, to duplicate the time-based action as an immediate action. This way when you create a test record to trigger the workflow, and go to save the record you will immediately receive a meaningful error that will explain the issue and the related apex class/trigger (if caused by apex).
Note: It is recommended all testing be carried out in a sandbox, but do check first to make sure the time-based workflow doesn't function correctly in the sandbox, as otherwise you will receive no error!