action.skip

How to fix failed jobs due to inactive users?

← Setup and Service FAQ ← Salesforce Environment FAQ

Certain business use cases require specific operations to run automatically on a regular basis. To support this, JustOn Billing & Invoice Management allows for scheduling jobs, that is, for executing a series of linked operations (batch chains) at a defined interval. For details, see Scheduling Concepts.

Scheduled jobs relate to the user who created them 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.

General Approach

To "unbind" a scheduled job from an inactive user:

  1. Click to enter Setup, then open Scheduled Jobs.
  2. Delete the job concerned, and confirm the operation.

    This deletes the current scheduled job that relates to the inactive user.

To reassociate the job with an active user:

  1. Log in (or have another user of your org log in) as an active user to be related as the running user.
  2. Open the Scheduled Jobs page.

    Use the following URL https://login.salesforce.com/apex/ONB2__JobsSetup, or, if you are already logged in, append apex/apex/ONB2__JobsSetup to your org's domain name.

    You can access the Scheduled Jobs page via the JustOn configuration app ( > JustOn Configuration > Jobs Setup).

  3. From the Apex Job drop-down list, select the intended job.

  4. In the Job Name field, specify the name of the batch chain or the name of the batch parameters setting as necessary.

    For details, see Scheduling Concepts.

  5. From the Start Time drop-down list, select the preferred execution time.

  6. Optionally, edit the displayed cron expression to adjust the execution time.
  7. Click Schedule.

    This recreates the scheduled job, relating to the active user as the running user.

Special Case: EmailJobChain

JustOn Billing & Invoice Management 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 to be set up as a scheduled job to send out the emails automatically at a specific time. The setup behavior, however, differs from other JustOn jobs: 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".

This is why you fix the failing job execution for the EmailJobChain due to an inactive user in another way:

  1. Click to enter Setup, then open Scheduled Jobs.
  2. Delete EmailJobChain, and confirm the operation.

    This deletes the current scheduled job that relates to the inactive user.

  3. 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.

Related information:

Monitoring Scheduled Jobs in the Salesforce Help
Apex job fails with message, 'First error: Inactive User' in the Salesforce Help