{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Scheduled Jobs","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"scheduled-jobs","__idx":0},"children":["Scheduled Jobs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure automated sync jobs to keep your Salesforce data current with Onboarded™."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important:"]}," Batch jobs run as the user who schedules them. Ensure this user has the Onboarded™ Admin permission set and access to all objects/fields being synchronized. See the Execution Context page for details."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"scheduled-sync-setup","__idx":1},"children":["Scheduled Sync Setup"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"setup-ui-method","__idx":2},"children":["Setup UI Method"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Open Onboarded™ Setup."]}," Navigate to the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Onboarded™ Setup"]}," tab."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Go to Scheduled Jobs Tab."]}," Click on the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Scheduled Jobs"]}," section."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configure Schedule."]}," Set your preferred schedule using the CRON expression builder or presets."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save and Enable."]}," Save your configuration and enable the scheduled job."]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Alternative — Manual Scheduling via Setup."]}," You can also schedule jobs manually from ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Setup → Apex Classes → Schedule Apex"]},". If you use this method, the Onboarded™ Setup UI will still detect the scheduled job and update accordingly, as long as the job name starts with \"Onboarded\" (e.g., \"OnboardedSyncScheduler\"). Jobs scheduled with other names will run but won't be reflected in the Onboarded™ Setup interface."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"apex-method","__idx":3},"children":["Apex Method"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Schedule Daily at 2 AM"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"apex","header":{"controls":{"copy":{}}},"source":"// Schedule default daily sync at 2:00 AM\nOnboardedSyncScheduler.scheduleDaily();\n","lang":"apex"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Custom CRON Schedule"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"apex","header":{"controls":{"copy":{}}},"source":"// Schedule every 4 hours\nOnboardedSyncScheduler.scheduleWithCron('0 0 0,4,8,12,16,20 * * ?');\n\n// Schedule weekdays at 6 AM\nOnboardedSyncScheduler.scheduleWithCron('0 0 6 ? * MON-FRI');\n","lang":"apex"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["View Active Schedules"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"apex","header":{"controls":{"copy":{}}},"source":"// List all scheduled Onboarded jobs\nList<CronTrigger> jobs = OnboardedSyncScheduler.getScheduledJobs();\nfor (CronTrigger job : jobs) {\n    System.debug(job.CronJobDetail.Name + ' - Next: ' + job.NextFireTime);\n}\n","lang":"apex"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Remove All Schedules"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"apex","header":{"controls":{"copy":{}}},"source":"// Unschedule all Onboarded sync jobs\nOnboardedSyncScheduler.unscheduleAll();\n","lang":"apex"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important — Scheduled Jobs Run As The Scheduling User."]}," Salesforce scheduled jobs execute in the security context of the user who scheduled them. This affects CRUD/FLS permissions, sharing rules, and record access."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Best practices:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Schedule jobs using an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["integration user"]}," or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["system administrator account"]}," with appropriate data access"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Avoid scheduling under individual user accounts that may be deactivated — deactivating the scheduling user will cause the job to fail"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the scheduling user leaves the organization, reassign or reschedule the job under an active admin account"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-cron-expressions","__idx":4},"children":["Common CRON Expressions"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Schedule"},"children":["Schedule"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"CRON Expression"},"children":["CRON Expression"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Daily at 2:00 AM"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 0 2 * * ?"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Every 6 hours"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 0 0,6,12,18 * * ?"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Weekdays at 7:00 AM"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 0 7 ? * MON-FRI"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Every hour"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 0 * * * ?"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sunday at midnight"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0 0 0 ? * SUN"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"batch-size-configuration","__idx":5},"children":["Batch Size Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Batch Size"]}," setting controls how many records are processed in each batch execution during sync operations. This setting is configurable in the Onboarded™ Setup interface."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Setting"},"children":["Setting"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Details"},"children":["Details"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Valid Range"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["1 to 2000 records per batch"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Default Value"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["200 records"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"batch-size-tuning","__idx":6},"children":["Batch Size Tuning"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Decrease batch size"]}," if you encounter governor limit errors (CPU time, heap size, SOQL queries) due to complex triggers, validation rules, or automation on the target objects"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Increase batch size"]}," if sync operations are taking too long and you have minimal automation on target objects"]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tip:"]}," Start with the default value of 200. If you experience governor limit issues, try reducing to 100 or 50. Only increase above 200 if you have tested thoroughly and confirmed your org can handle larger batches."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"batch-sync-exemption-rules","__idx":7},"children":["Batch Sync Exemption Rules"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Batch Sync Exemption Rules"]}," allow you to exclude specific records from being synced based on field values in the Onboarded™ API response. This is useful when you want to filter out certain records before they are created or updated in Salesforce."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"exemption-rule-mechanics","__idx":8},"children":["Exemption Rule Mechanics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a sync batch runs, API records are checked against active exemption rules ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["before"]}," being processed. Records that match any active exemption rule are excluded from the sync operation."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"exemption-rule-creation","__idx":9},"children":["Exemption Rule Creation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Exemption rules can be configured in the Onboarded™ Setup interface. Each rule requires:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Onboarded™ Object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Onboarded™ object type this rule applies to (e.g., Employee, Employer, Task)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Onboarded™ API Field"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The API field name to evaluate. Supports nested fields using dot notation (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["address.city"]},")"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Match Type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["How to evaluate the field value (see match types below)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Exemption Value"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The value to match against (required for \"equals\" match type)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Is Active"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Toggle to enable or disable the rule"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"match-types","__idx":10},"children":["Match Types"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Match Type"},"children":["Match Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Example Use Case"},"children":["Example Use Case"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["equals"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Field value exactly matches the exemption value"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Exclude employees where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]}," equals ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["terminated"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isBlank"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Field value is null, empty, or whitespace"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Exclude records where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]}," is blank"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isNotBlank"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Field value is not null and not empty"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Exclude records that have a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["do_not_sync"]}," flag populated"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-exemption-rules","__idx":11},"children":["Example Exemption Rules"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Exclude terminated employees:"]}," Onboarded™ Object = Employee, API Field = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status"]},", Match Type = equals, Value = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["terminated"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Exclude test records:"]}," Onboarded™ Object = Employee, API Field = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", Match Type = equals, Value = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["test@example.com"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Exclude records without email:"]}," Onboarded™ Object = Employee, API Field = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["email"]},", Match Type = isBlank"]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," Exempted records are counted in sync statistics but are not created or updated in Salesforce. If an exemption rule is later deactivated or removed, previously exempted records will be synced on the next batch run."]}]}]},"headings":[{"value":"Scheduled Jobs","id":"scheduled-jobs","depth":1},{"value":"Scheduled Sync Setup","id":"scheduled-sync-setup","depth":2},{"value":"Setup UI Method","id":"setup-ui-method","depth":3},{"value":"Apex Method","id":"apex-method","depth":3},{"value":"Common CRON Expressions","id":"common-cron-expressions","depth":2},{"value":"Batch Size Configuration","id":"batch-size-configuration","depth":2},{"value":"Batch Size Tuning","id":"batch-size-tuning","depth":3},{"value":"Batch Sync Exemption Rules","id":"batch-sync-exemption-rules","depth":2},{"value":"Exemption Rule Mechanics","id":"exemption-rule-mechanics","depth":3},{"value":"Exemption Rule Creation","id":"exemption-rule-creation","depth":3},{"value":"Match Types","id":"match-types","depth":3},{"value":"Example Exemption Rules","id":"example-exemption-rules","depth":3}],"frontmatter":{"seo":{"title":"Scheduled Jobs"}},"lastModified":"2026-05-29T01:46:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/onboarded_for_salesforce/scheduled_jobs","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}