Salesforce archiving options compared
Delete and export, Big Objects, Salesforce Archive, off-platform apps and 100% Native, with trade-offs.
Read the guideORGZIP / GUIDES
When you archive old Email-to-Case emails to cut Salesforce Data Storage costs, AI agents normally lose sight of them. A 100% Native Invocable Apex Action lets Agentforce, Prompt Builder and Flows read archived Case history on demand — with quoted reply chains stripped and live Case sharing plus FLS enforced.
Short answer: Agentforce grounds its responses on live Salesforce records and configured actions. Once closed-Case EmailMessage, CaseComment, Task or Event records are purged from Data Storage — or converted into flat PDFs or pushed to an external cloud — standard Case queries return nothing for that history.
Teams then face an expensive trade-off: either pay for extra Salesforce Data Storage to keep years of old emails live so AI agents stay informed, or archive aggressively and accept that Agentforce misses prior refund promises, RMA numbers and recurring escalations.
Because OrgZip stores compressed archive bundles natively inside Salesforce Files in your own org, an Apex Invocable Action can read the relevant parent record’s archived history in real time, strip repetitive quoted replies, and pass clean chronological text straight into Agentforce or Prompt Builder — without restoring a single record back to Data Storage.
| Approach | Frees Data Storage? | Agentforce can read old emails? | Live Case sharing & FLS |
|---|---|---|---|
| Keep emails live in Salesforce | No — Data Storage keeps growing. | Yes, via standard Case context, but raw HTML and quoted threads waste tokens. | Native Salesforce sharing and FLS. |
| Convert Case emails to PDF | Yes, after deleting source emails. | Not as structured Case email history; requires separate file extraction. | Follows file sharing, not field-level email security. |
| Off-platform archive (external cloud) | Yes. | Requires external API callouts, credentials and custom integration. | Often requires rebuilding or syncing sharing rules outside Salesforce. |
| 100% Native ZIP archive + Invocable Action (OrgZip) | Yes — moves heavy bodies into compact ZIP files in File Storage. | Yes — native Get Archived Record History action returns clean text + JSON. | Checked live on every call (Archive_Viewer, UserRecordAccess, FLS). |
OrgZip ships a global invocable Apex method labeled Get Archived Record History (category OrgZip, class ArchiveAgentAction). Because it is standard Invocable Apex, it works across Agentforce Agent Actions, Prompt Builder (via Flow or Apex), and Screen or Autolaunched Flows.
| Input variable | Required | Default / Range | What it does |
|---|---|---|---|
parentId | Yes | Case, Account or parent ID | Identifies the parent record whose archived history should be retrieved. |
objectApiName | No | EmailMessage (or CaseComment, Task, Event, custom object, ALL) | Scopes retrieval to one archived object or merges across all accessible archived objects. |
searchTerm | No | Blank (all records) | Filters archived records by keyword across subject, sender, recipient, body and original ID. |
maxRecords | No | 10 (range 1–25) | Caps how many newest-first matching archived records are returned. |
maxCharacters | No | 8,000 (range 500–32,000) | Fits the formatted summary cleanly inside your prompt’s token budget. |
stripQuotedText | No | true | Removes repetitive quoted email reply chains to maximize AI context signal. |
| Output variable | Type | How Agentforce or Flow uses it |
|---|---|---|
summaryText | String | Clean, chronological plain-text summary (with object label, date, From/To, stripped body and attachment titles) ready for direct prompt grounding. |
recordsJson | String | Structured JSON array of FLS-masked archived records for downstream parsing or custom UI. |
recordCount | Integer | Exact count of archived records included in the response. |
truncated | Boolean | true when additional matching records or characters exceeded the configured limits or CPU guardrail. |
ArchiveViewer permission set (which includes the Archive_Viewer custom permission) to the running user or Agentforce service user. Do not grant ArchiveAdmin to an AI agent.Get Archived Record History under category OrgZip.stripQuotedText = true and tune maxCharacters. The default 8,000-character budget fits comfortably in most Service Agent and Case Summary prompt templates without crowding out live fields.with sharing, checks the Archive_Viewer custom permission upfront, verifies current parent record access via UserRecordAccess, and applies current Salesforce field-level security (FLS) to every returned field.truncated = true so your prompt or agent knows more history exists.Full data-flow and permission details are on Security and data handling. Ready to test in a sandbox? Follow the 5-minute install guide.
Standard Salesforce archiving removes records from live tables, so Agentforce cannot see them through normal SOQL or standard Case lookups. With a native Invocable Apex Action like OrgZip’s Get Archived Record History, Agentforce, Prompt Builder and Flows retrieve archived emails, Case comments, Tasks, Events or custom records on demand without restoring them to Data Storage.
No, if the action enforces live access controls. OrgZip’s ArchiveAgentAction runs with sharing, requires the Archive_Viewer permission, checks current parent record access via UserRecordAccess on every request, and masks fields using current field-level security before returning summaryText or recordsJson.
Email-to-Case threads repeat earlier messages at the bottom of every reply. Sending raw threads wastes prompt context tokens and dilutes retrieval quality. OrgZip’s stripQuotedText option defaults to true, keeping each unique message turn clean and chronological inside the character budget.
No. The Invocable Action reads compressed ZIP snapshots directly from Salesforce Files in memory and returns formatted text or JSON to the agent or flow. Nothing is restored or written back into Data Storage.
OrgZip’s Get Archived Record History returns 1 to 25 records per call (default 10) and up to 32,000 characters of formatted summary text (default 8,000). It also enforces Apex governor safety limits (scanning up to 20 matching bundles and stopping at 60% CPU time) and sets the truncated output flag to true if more matches exist.
Delete and export, Big Objects, Salesforce Archive, off-platform apps and 100% Native, with trade-offs.
Read the guideEmailMessage storage measured in a test org: body size, the Recycle Bin, and what archiving freed.
Read the guideWhat a PDF keeps and loses compared with an archive: search, reply, restore and cost.
Read the guideInstall OrgZip in a sandbox, archive a sample of closed-Case emails, and test Get Archived Record History directly in Flow or Agentforce.