Scheduled Jobs
Overview
Section titled “Overview”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.
Shipped jobs
Section titled “Shipped jobs”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 name | Schedule | Purpose |
|---|---|---|
OrgGuard Daily Discovery | Daily at 2 AM (default) — Daily / Weekly / Custom cron selectable in wizard | Runs the full discovery → policy evaluation → notification pipeline |
OrgGuard Notification Scheduler | Hourly at :00 | Retries or flushes pending Notification sends |
OrgGuard Data Retention | Daily at midnight | Purges old records according to your configured retention policies |
OrgGuard Log Level Checker | Hourly at :15 | Expires Support Mode (48h) and Debug Mode (4h) auto-timers |
OrgGuard SJH Daily Poll (Flow) | Daily at 6 AM | Triggers 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.
What you’ll see
Section titled “What you’ll see”Scheduled Job Inventory
Section titled “Scheduled Job Inventory”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.
Setup → Scheduled Jobs
Section titled “Setup → Scheduled Jobs”Each scheduled job row shows:
| Column | Meaning |
|---|---|
| Job Name | The schedulable label |
| Submitted By | User under whose identity the job runs |
| Started | When the current/next run starts |
| Next Scheduled Run | Next scheduled timestamp |
| Type | Usually “Scheduled Apex” |
| Action | Del link to remove the scheduled job |
Setup → Apex Jobs
Section titled “Setup → Apex Jobs”Shows past execution history — batch runs with counts, errors, status. Filter by jobs starting with “OrgGuard” to see every past run.
Common tasks
Section titled “Common tasks”Task: See every OrgGuard job currently scheduled
Section titled “Task: See every OrgGuard job currently scheduled”Who can do this: System Administrator.
- Setup → Scheduled Jobs.
- In the list, look for any job name starting with OrgGuard.
- Note each job’s Next Scheduled Run — if any show as blank or a past date, the job may need to be rescheduled.
Task: Change the discovery scan schedule
Section titled “Task: Change the discovery scan schedule”The easiest path is the Setup Wizard, which handles delete + reschedule atomically:
- Setup → App Launcher → OrgGuard Setup (or click the OrgGuard “Run Setup Wizard” link in the app).
- Advance to Step 4 — Discovery Schedule.
- Choose Daily, Weekly, or Custom (cron expression).
- Click Next and complete the wizard.
- Expected result: the old discovery job is deleted; a new one is scheduled with the updated cadence.
Manual path (advanced, System Admin only):
- Setup → Scheduled Jobs — click Del on the OrgGuard discovery job.
- Execute anonymous Apex with your desired cron expression:
String cron = '0 0 2 * * ?'; // Daily at 2 AMSystem.schedule('OrgGuard Daily Discovery', cron, new orgguard.DiscoveryScheduler());
- Return to Setup → Scheduled Jobs to confirm the new entry.
Task: Change the retention schedule
Section titled “Task: Change the retention schedule”Not typically needed — daily at midnight is fine for most orgs. If you need off-hours coverage:
- Delete the existing
OrgGuard Data Retentionjob from Setup → Scheduled Jobs. - Schedule anonymously:
String cron = '0 0 3 * * ?'; // Daily at 3 AMSystem.schedule('OrgGuard Data Retention', cron,new orgguard.DataRetentionScheduler());
Task: Investigate a stuck or missed job
Section titled “Task: Investigate a stuck or missed job”If a scan didn’t run overnight, or a retention batch seems skipped:
- Setup → Apex Jobs.
- Filter by job name starting with “OrgGuard”.
- Check the most recent entry’s Status and Extended Status.
- 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.
- 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).
- Open OrgGuard Setup from the App Launcher (type “OrgGuard Setup” in the search field).
- On the OrgGuard Monitoring Jobs card, click Reschedule monitoring jobs.
- 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, andOrgGuard Log Level Checkershow 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:
- Open Setup → Scheduled Jobs and count the OrgGuard entries.
- Expected: 5 entries — four Apex jobs (
OrgGuard Daily Discovery,OrgGuard Notification Scheduler,OrgGuard Data Retention,OrgGuard Log Level Checker) plus theOrgGuard SJH Daily PollSchedule-Triggered Flow. - If any are missing, re-install or upgrade the OrgGuard package — the
OrgGuardPostInstallhandler re-schedules the Apex jobs it owns, and theOrgGuard SJH Daily Pollflow 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:
- Setup → Scheduled Jobs.
- Click Del on every OrgGuard job.
- 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.
Schedule reference
Section titled “Schedule reference”| Setting | Default | Configurable? |
|---|---|---|
| Discovery scan time | 2 AM | Yes — Setup Wizard Step 4 (Daily / Weekly / Custom cron) |
| Retention job time | Midnight (00:00) | Yes — via anonymous Apex System.schedule |
| Log Level Checker | :15 past each hour | Fixed — do not change unless you understand Support/Debug Mode expiry |
| Notification Scheduler | Hourly | Fixed 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.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | Fix |
|---|---|---|
OrgGuard Daily Discovery job missing from Scheduled Jobs | Job was deleted; or Setup Wizard was never completed | Re-run the Setup Wizard end-to-end. |
| Scheduled job shows Next Run in the past | Job is stuck or locked | Delete 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’t | Retention 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 hours | Log Level Checker job missing | Reschedule; or re-run the Setup Wizard. |
| All jobs reflect an old schedule after upgrade | Scheduler classes changed in upgrade | Delete all OrgGuard entries; re-run Setup Wizard to reschedule with current classes. |
| Email alerts or in-app notifications never arrive | Monitoring jobs still owned by the package system user (no FLS) — never re-owned to an admin | Click 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 work | The 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.NameFROM CronTriggerWHERE 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.
Related
Section titled “Related”- Scheduled Job Health Monitoring — full KPI card and finding-type reference for this dashboard
- Scan Management — the user-facing surface for discovery scans
- Data Retention — what the retention job does
- Diagnostic Logging — Log Level Checker context
- Setup Wizard — the easiest path to (re)schedule all OrgGuard jobs
- Permission Sets — who can view and modify scheduled jobs