{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Error Handling and Sync Queue","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":"error-handling-and-sync-queue","__idx":0},"children":["Error Handling and Sync Queue"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Onboarded™ application includes robust error handling for API operations, including automatic retry capabilities and deferred processing when system limits are reached."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"error-sync-queue-overview","__idx":1},"children":["Error Sync Queue Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Onboarded_Sync_Queue__c"]}," object stores sync requests that cannot be processed immediately. Requests are queued in the following scenarios:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Queueable Limits Reached:"]}," Salesforce limits the number of queueable jobs that can be enqueued. When this limit is reached, requests are stored for later processing."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Inbound Sync In Progress:"]}," To prevent conflicts, outbound sync requests made during an inbound sync are deferred."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["API Failures:"]}," Failed API calls may result in records being queued for retry."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"queue-mechanics","__idx":2},"children":["Queue Mechanics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a record is inserted into the Sync Queue, an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["after insert trigger"]}," automatically fires and enqueues a Queueable job to process pending records. The processor:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Retrieves all pending records from the queue (up to 200 at a time)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Attempts to process each request by making the appropriate API call"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Updates the record status based on the result"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Increments the retry count for failed attempts"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The trigger includes safeguards to prevent re-entrancy and will skip processing if an inbound sync is already in progress or if queueable limits have been reached. In those cases, records remain in Pending status and will be processed when the next queue record is inserted or when capacity becomes available."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"queue-record-statuses","__idx":3},"children":["Queue Record Statuses"]},{"$$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":"Status"},"children":["Status"]},{"$$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":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Pending"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Record is waiting to be processed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Processing"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Record is currently being processed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Failed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Request failed after maximum retry attempts"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"self-cleaning-behavior","__idx":4},"children":["Self-Cleaning Behavior"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Sync Queue is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["self-cleaning"]},". Successfully processed records are immediately deleted from the queue. There is no \"Completed\" status — once a request is successfully processed, the queue record is removed."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only records that have failed processing remain in the queue for review."]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important:"]}," While the queue is self-cleaning for successful operations, ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["you should monitor this object for any failed records"]},". Failed records indicate sync issues that may require manual intervention, such as:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Invalid data that the Onboarded™ API rejected"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Authentication issues"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Records that exceeded the maximum retry count"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["API endpoint availability issues"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"queue-monitoring","__idx":5},"children":["Queue Monitoring"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To monitor sync queue health:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create a List View on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Onboarded_Sync_Queue__c"]}," filtered to show ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Status = Failed"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Review the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Error_Message__c"]}," field for details on why the request failed"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Check the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry_Count__c"]}," field to see how many attempts were made"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Consider creating a Report or Dashboard to track queue health over time"]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tip:"]}," Set up a workflow rule or Flow to send email notifications when records enter a Failed status, so you can address issues promptly."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both the Employee Onboarded and Workflow Onboarded components also support an optional inline error log panel — enable the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Show Error Logs"]}," design property in Lightning App Builder to surface the last 30 days of Error Log entries for the displayed record (and per-Workflow, on the Employee Onboarded component). This gives HR users visibility into sync failures without leaving the record page."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"failed-record-resolution","__idx":6},"children":["Failed Record Resolution"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you encounter failed queue records:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Review the error message"]}," to understand why the request failed"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Fix the underlying issue"]}," (e.g., correct invalid data, resolve authentication problems)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reset the record for retry"]}," by changing the Status back to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Pending"]}," and setting ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Retry_Count__c"]}," to 0"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Delete the record"]}," if it's no longer needed or the data has been synced through other means"]}]}]},"headings":[{"value":"Error Handling and Sync Queue","id":"error-handling-and-sync-queue","depth":1},{"value":"Error Sync Queue Overview","id":"error-sync-queue-overview","depth":2},{"value":"Queue Mechanics","id":"queue-mechanics","depth":2},{"value":"Queue Record Statuses","id":"queue-record-statuses","depth":3},{"value":"Self-Cleaning Behavior","id":"self-cleaning-behavior","depth":2},{"value":"Queue Monitoring","id":"queue-monitoring","depth":2},{"value":"Failed Record Resolution","id":"failed-record-resolution","depth":2}],"frontmatter":{"seo":{"title":"Error Handling and Sync Queue"}},"lastModified":"2026-05-29T01:46:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/onboarded_for_salesforce/error_handling_and_sync_queue","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}