How to fix failed jobs due to inactive users?
By default, JustOn supports the distribution of the generated invoice PDF documents via email. To this end, it provides the Apex class EmailJobChain (BatchInvoiceEmailJob in older versions), which is set up as a scheduled job to send out the emails automatically at a specific time.
In a new instance, JustOn sets up the corresponding scheduled job when a user manually sends out an invoice email for the first time. The scheduled job then relates to this user as the "running user", however, the user does not need to be logged in for the job to run.
Now if an org inactivates the user registered as the running user, the job execution fails, relating to the inactive user. To fix this, you must recreate the job with an active user.
- In Setup, open Scheduled Jobs.
Delete EmailJobChain, and confirm the operation.
This deletes the current scheduled job that relates to the inactive user.
Have an invoice email sent by an active user as described in Emailing Invoice PDF Documents (or send it yourself).
This recreates the scheduled job, relating to the active user as the running user.
Monitoring Scheduled Jobs in the Salesforce Help
Apex job fails with message, 'First error: Inactive User' in the Salesforce Help