Skip to content

Scheduled Jobs

OrgGuard uses the standard Salesforce Scheduled Apex mechanism to run its recurring jobs — discovery scans, retention purge, log-mode expiry checks, and notification processing. All of this is visible in Setup → Scheduled Jobs. Nothing runs outside your org.

This page covers what each job does, how to change schedules, and how to investigate a job that isn’t running as expected.


The OrgGuardPostInstall install handler schedules four Apex jobs when the package is installed or upgraded (not the Setup Wizard), and one Schedule-Triggered Flow auto-schedules itself on install:

Job nameSchedulePurpose
OrgGuard Daily DiscoveryDaily at 2 AM (default) — Daily / Weekly / Custom cron selectable in wizardRuns the full discovery → policy evaluation → notification pipeline
OrgGuard Notification SchedulerHourly at :00Retries or flushes pending Notification sends
OrgGuard Data RetentionDaily at midnightPurges old records according to your configured retention policies
OrgGuard Log Level CheckerHourly at :15Expires Support Mode (48h) and Debug Mode (4h) auto-timers
OrgGuard SJH Daily Poll (Flow)Daily at 6 AMTriggers scheduled-job health failure detection (consecutive-failure counting). Runs as a Schedule-Triggered Flow, so it appears under Scheduled Jobs as a flow rather than an Apex job.

Treat anything starting with OrgGuard in Setup → Scheduled Jobs as OrgGuard-owned.


The Scheduled Job Inventory dashboard shows a refresh cadence note below the KPI cards (Total Jobs, Active, Failing, Error State):

When discovery scan is active:

Scheduled Job status is refreshed once per day during the OrgGuard Daily Discovery scan. Next refresh: .

When discovery scan is paused:

⚠️ Scheduled Job discovery is paused. Status won’t refresh until the daily scan is re-enabled.

The “Next refresh” timestamp displays in your configured Salesforce timezone and locale. This tells you when Last Run timestamps and job status information will next update. If the OrgGuard Daily Discovery job is paused or missing, the disclaimer warns that no refresh will occur until the job is rescheduled.

Each scheduled job row shows:

ColumnMeaning
Job NameThe schedulable label
Submitted ByUser under whose identity the job runs
StartedWhen the current/next run starts
Next Scheduled RunNext scheduled timestamp
TypeUsually “Scheduled Apex”
ActionDel link to remove the scheduled job

Shows past execution history — batch runs with counts, errors, status. Filter by jobs starting with “OrgGuard” to see every past run.


Task: See every OrgGuard job currently scheduled

Section titled “Task: See every OrgGuard job currently scheduled”

Who can do this: System Administrator.

  1. Setup → Scheduled Jobs.
  2. In the list, look for any job name starting with OrgGuard.
  3. Note each job’s Next Scheduled Run — if any show as blank or a past date, the job may need to be rescheduled.

The easiest path is the Setup Wizard, which handles delete + reschedule atomically:

  1. Setup → App Launcher → OrgGuard Setup (or click the OrgGuard “Run Setup Wizard” link in the app).
  2. Advance to Step 4 — Discovery Schedule.
  3. Choose Daily, Weekly, or Custom (cron expression).
  4. Click Next and complete the wizard.
  5. Expected result: the old discovery job is deleted; a new one is scheduled with the updated cadence.

Manual path (advanced, System Admin only):

  1. Setup → Scheduled Jobs — click Del on the OrgGuard discovery job.
  2. Execute anonymous Apex with your desired cron expression:
    String cron = '0 0 2 * * ?'; // Daily at 2 AM
    System.schedule('OrgGuard Daily Discovery', cron, new orgguard.DiscoveryScheduler());
  3. Return to Setup → Scheduled Jobs to confirm the new entry.

Not typically needed — daily at midnight is fine for most orgs. If you need off-hours coverage:

  1. Delete the existing OrgGuard Data Retention job from Setup → Scheduled Jobs.
  2. Schedule anonymously:
    String cron = '0 0 3 * * ?'; // Daily at 3 AM
    System.schedule('OrgGuard Data Retention', cron,
    new orgguard.DataRetentionScheduler());

If a scan didn’t run overnight, or a retention batch seems skipped:

  1. Setup → Apex Jobs.
  2. Filter by job name starting with “OrgGuard”.
  3. Check the most recent entry’s Status and Extended Status.
  4. Common outcomes:
    • Completed with zero failures — ran fine; the concern is somewhere else.
    • Completed with some failures — open the related Scan Run record and read Error Summary.
    • Aborted — someone cancelled the run; re-schedule.
    • No recent entry at all — the job may have been deleted; reschedule via Setup Wizard.
  5. For deep context (OrgGuard Admin only), enable Diagnostic Logging Support Mode and wait for the next run.

Task: Reschedule monitoring jobs (if email or in-app alerts aren’t arriving)

Section titled “Task: Reschedule monitoring jobs (if email or in-app alerts aren’t arriving)”

Who can do this: OrgGuard Admin.

OrgGuard’s monitoring jobs are first scheduled at install under the package’s system user, which can’t read OrgGuard’s data — so until an admin re-owns them, scheduled email alerts, in-app notifications, retention, and log-mode resets silently don’t run. Completing the Setup wizard does this automatically; this action is the one-click equivalent (use it on existing orgs, or any time alerts stop arriving).

  1. Open OrgGuard Setup from the App Launcher (type “OrgGuard Setup” in the search field).
  2. On the OrgGuard Monitoring Jobs card, click Reschedule monitoring jobs.
  3. Expected result: a success toast confirms the jobs were rescheduled under your user. Confirm in Setup → Scheduled Jobs that OrgGuard Notification Scheduler, OrgGuard Data Retention, and OrgGuard Log Level Checker show your name under Submitted By (not blank).

Task: Re-schedule OrgGuard jobs after a package upgrade

Section titled “Task: Re-schedule OrgGuard jobs after a package upgrade”

Package upgrades shouldn’t remove scheduled jobs, but hotfix or ISV patches occasionally do. After any upgrade:

  1. Open Setup → Scheduled Jobs and count the OrgGuard entries.
  2. Expected: 5 entries — four Apex jobs (OrgGuard Daily Discovery, OrgGuard Notification Scheduler, OrgGuard Data Retention, OrgGuard Log Level Checker) plus the OrgGuard SJH Daily Poll Schedule-Triggered Flow.
  3. If any are missing, re-install or upgrade the OrgGuard package — the OrgGuardPostInstall handler re-schedules the Apex jobs it owns, and the OrgGuard SJH Daily Poll flow re-schedules itself on install.

Task: Pause all OrgGuard background activity temporarily

Section titled “Task: Pause all OrgGuard background activity temporarily”

For maintenance windows or major testing:

  1. Setup → Scheduled Jobs.
  2. Click Del on every OrgGuard job.
  3. When ready to resume, re-run the Setup Wizard to reschedule.

Disabling instead of deleting is not supported by the standard Scheduled Jobs UI — deletion is the only available pause mechanism.


SettingDefaultConfigurable?
Discovery scan time2 AMYes — Setup Wizard Step 4 (Daily / Weekly / Custom cron)
Retention job timeMidnight (00:00)Yes — via anonymous Apex System.schedule
Log Level Checker:15 past each hourFixed — do not change unless you understand Support/Debug Mode expiry
Notification SchedulerHourlyFixed in OrgGuard Pro 1.0

Salesforce governor limits apply to all scheduled Apex — each class can have at most 100 scheduled job instances org-wide (including non-OrgGuard). If you hit the limit, delete unused jobs.


SymptomLikely causeFix
OrgGuard Daily Discovery job missing from Scheduled JobsJob was deleted; or Setup Wizard was never completedRe-run the Setup Wizard end-to-end.
Scheduled job shows Next Run in the pastJob is stuck or lockedDelete and re-schedule; check Apex Jobs for an aborted entry.
”You’ve exceeded the maximum number of scheduled jobs”Org has 100 scheduled jobs (Salesforce limit)Setup → Scheduled Jobs → delete unused jobs; then retry OrgGuard scheduling.
Discovery runs but retention doesn’tRetention job not scheduled (some upgrade paths skip it)Re-run the Setup Wizard or reschedule via anonymous Apex (see task above).
Support Mode doesn’t auto-disable after 48 hoursLog Level Checker job missingReschedule; or re-run the Setup Wizard.
All jobs reflect an old schedule after upgradeScheduler classes changed in upgradeDelete all OrgGuard entries; re-run Setup Wizard to reschedule with current classes.
Email alerts or in-app notifications never arriveMonitoring jobs still owned by the package system user (no FLS) — never re-owned to an adminClick Reschedule monitoring jobs on the OrgGuard Setup tab (or complete the Setup wizard), then re-check Email Deliverability and the org-wide sender.
Scheduled discovery finds nothing or errors, but manual scans workThe OrgGuard Daily Discovery job is still owned by the package system user — its metadata reads fail FLS and its Tooling/Metadata callouts return HTTP 401 (the system user can’t render the session-provider page)Complete the wizard’s Discovery Schedule step (Step 4) to re-own the job to your admin user; the next scheduled run then succeeds.

What user identity do OrgGuard scheduled jobs run as? Whichever user scheduled them — standard Salesforce Apex Scheduler behavior — but with an important nuance. The jobs are first scheduled by OrgGuardPostInstall at install, which runs as the package system user, not the installing admin. That system user has no field-level access to OrgGuard’s objects, so the scheduled queries silently fail and the jobs do nothing. Completing the Setup wizard re-owns all four Apex jobs to you — the three monitoring jobs when you finish the wizard, and OrgGuard Daily Discovery via the Discovery Schedule step. The Reschedule monitoring jobs action on the OrgGuard Setup tab re-owns the three monitoring jobs on demand. After re-owning, the jobs run under your identity — keep that user active, or reschedule under a dedicated integration user to avoid losing context if they’re deactivated.

Can I schedule multiple discovery runs per day? Yes via anonymous Apex with a non-daily cron expression (e.g. every 6 hours). The Setup Wizard doesn’t expose this directly. Be careful — scans consume governor limits and storage; daily is a good default for most orgs.

What’s the minimum interval I can schedule? Scheduled Apex minimum granularity is 1 hour (cron 0 0 * * * ?). For tighter intervals, use Queueable chaining — not currently exposed by OrgGuard.

Does OrgGuard use a Cron Trigger or CronJobDetail object I can query? Both are queryable via standard Salesforce SOQL:

SELECT Id, CronExpression, NextFireTime, State, CronJobDetail.Name
FROM CronTrigger
WHERE CronJobDetail.Name LIKE 'OrgGuard%'

Will deleting a scheduled job cancel a run that’s already started? No — an in-flight batch continues to completion. Deletion only prevents future fires.

Can I use Platform Events instead of scheduled jobs? No. Scheduled Apex is the orchestrator for all periodic bulk work in OrgGuard Pro 1.0. Platform-Event-driven flows are not built — any Pro+/Max enhancements in this area are roadmap items, not part of OrgGuard Pro 1.0.