Skip to content
Release 1 in development, 15 of 15 sprints done. Early access is open. 15 of 15 sprints done · Join early accessJoin early access
Guide

Keep or purge Intervals

Choose how long Sojourn keeps Intervals, what a purge deletes and keeps, and how summaries roll up and rebuild.

Salesforce admin About 5 minutes Since release 1

Every change to a Tracked field adds an Interval, so a busy org collects millions of rows. Sojourn keeps the totals in summary rows and lets you decide how long the Intervals themselves stay.

Summaries come first#

Each night the Summaries job counts closed Intervals into daily and monthly summary rows: how many Intervals, how many records, and the total, average, shortest, and longest time, in business and calendar minutes, per object, field, value, owner, and period. Set its time on the Jobs screen, under Operations; see Run the jobs. Report on summaries with the Sojourn Interval Summaries report type; see the Report cookbook.

Summary rows are never purged with Intervals. Daily rows older than the roll-up days, 400 unless you change it, are removed after a complete purge run; monthly rows are kept. See Summaries below.

Choose retention#

Purge and the archive are on the Plus plan. On the Free plan, every Interval is kept, and the screen shows Keep everything with a note; see Free and Plus plans.

Until you choose, the Sojourn Settings Overview shows Choose how long to keep Intervals, and neither choice is selected on the screen. Open Sojourn Settings, then Data, then Retention and purge:

  • Keep everything: nothing is deleted. Reports read every Interval.
  • Keep N days, from 30 to 3,650: each night after Summaries, closed Intervals older than this are saved to a CSV file and deleted; their summaries are kept.

Choose Save retention; it is off until you pick one. Keeping a number of days asks you to type DELETE first, because a purge deletes records. Days start and end at midnight in the org time zone.

Retention per object#

Each Tracked object can keep its Intervals for its own number of days, or keep all of them. Set it on the object's Advanced tab, in the Retention card (see The Advanced tab), and save with the object's Save:

  • Use the org's, the default: the object follows the choice on this screen, named beside it, for example "Use the org's: Keep 365 days".
  • Keep this object's Intervals for a number of days, from 30 to 3,650: a purge deletes this object's closed Intervals older than that, and leaves the rest of the org on its own window. The box shows the saved number, or 365 while none is saved; clear it to go back to 365. A number outside 30 to 3,650 is refused, and the notice names the Advanced tab. If such a number reaches the object some other way, through the API or a data load, Sojourn keeps every Interval of that object until its retention is saved again, lists it as "Everything", and writes one Config row to the Error Log saying why.
  • Keep everything for this object: a purge deletes none of this object's Intervals.

An object's own days apply only while the org keeps N days. With the org on Keep everything, nothing is purged, whatever an object is set to: deletion is turned on in one place, here, with DELETE typed. Intervals of an object Sojourn no longer tracks follow the org's window.

The Per object card on this screen lists every Tracked object and what it keeps: "Org's: 365 days" for an object that uses the org's, its own days, such as "90 days", or "Everything". The list is read only; choose an object's name to open its Advanced tab. While the org keeps everything, the card says that a purge deletes nothing until the org keeps N days.

Retention per object is on the Plus plan, with purge. On the Free plan the Retention card shows the object's choice with its controls off and the Plus notice, and the rest of the object still saves. It is not part of a settings file, so moving settings between orgs never changes what an org deletes.

What a purge deletes#

A purge deletes only Intervals that are closed, already summarised, and ended before their object's cutoff: midnight in the org time zone, that object's number of days ago. Open Intervals are never deleted, however old. A run deletes by one window for each distinct number of days, the org's first, and checks each object's window again at every part, so a change saved during a run applies from its next part.

It works in parts of 2,000 Intervals unless you change the part size (see The purge part size), so a purge of a million Intervals leaves 500 CSV files on its run. Each part is first written to a CSV file, attached to the run's Purge Run record, then deleted in the same step: a part is saved and deleted together, or not at all. The first part that fails stops the run, and the run says why. Choosing Keep everything while a purge runs stops it at its next part, and the run says the rest is kept. Purge now waits while summaries are being built or rebuilt, because a rebuild still reads the Intervals a purge would delete.

Each CSV file has a header row, then one row per Interval, in these columns: Interval, Object, Record Id, Record, Tracked field, From, To, To Id, Entered at, Exited at, Business minutes, Calendar minutes, Owner Id, Owner, Owner type, Source, Goal minutes, Breached, Sequence, Warning, Warned at, Record Closed, Value Group. Times are in UTC; Breached, Warning, and Record Closed are true or false. Record Closed and Value Group are what the summary rows group by: whether the record was closed during the stay, and the value group its value belonged to (blank when the field has no value groups).

The CSV file is your copy. Download it from the Purge Run record before you delete the record or the file. Sojourn never deletes them.

The archive#

Turn on Also copy to the archive to keep each purged Interval in Sojourn's archive object as well. The archive is a big object: the timeline shows its stays (see Show the timeline on a record), and Apex and the API can read it with SOQL, but reports and list views cannot, so a report counts only the Intervals that remain and the summary rows. An archived Interval keeps its values, owner, minutes, goal minutes, and Breach flag, its warning: Warning Flag (1 or 0), Warned At, and Warn Minutes, and what its summary rows group by: Record Closed Flag (1 or 0) and Value Group. Your org includes 1 million archive records; more is a paid add-on from Salesforce. The screen counts the archived Intervals for you: under Purge runs a line reads, for example, "8,090 Intervals archived so far, across 3 purge runs." It adds up what every run listed archived, so it shows from the first run, even when that run archived nothing ("0 Intervals archived so far"), and it does not show while no purge has run. It counts Intervals, not storage, so compare it with the 1 million included. On the Free plan the line is read only. It adds up the runs you can see: if you cannot see every Purge Run record, it counts only the ones you can, and it does not show if you cannot read Purge Run. The CSV file is kept on every run either way.

Purge now and the runs#

Purge now starts a run straight away, without waiting for the night. The button is on only while the saved choice is Keep N days: on a new install, and under Keep everything, it is off. Its confirmation counts what the run would delete now, for example "4,250 closed, summarised Intervals past their window are saved to a CSV file on the run, then deleted.", and lists each window with its count, such as "The org's 365 days: 4,000 Intervals" and "Lead, 90 days: 250 Intervals", then each object kept whole, such as "Claim: Keep everything, none deleted." Type DELETE to confirm. One purge runs at a time; a second is refused with "A purge is already running. Try again when it finishes."

Purge runs lists each run: when it ran, its status (Queued, Running, Complete, or Failed), how many Intervals it deleted and archived, and how many files it holds; choose the files to open the run. A run counts its Intervals as each part finishes, so a run that stopped part-way shows what it deleted before it stopped. The run's record also keeps Interval Count: how many Intervals the run set out to delete when it started, so you can compare it with what it deleted. Its Message says how many Intervals the run deleted in all and under each window, for example "The org's 365 days: 4,210 deleted. Lead, 90 days: 250 deleted.", and names the objects kept whole. If the org moves to the Free plan while a purge runs, the run deletes nothing from its next part on, keeps the Day summary rows, and its message says so.

The purge part size#

Under the Purge card, open Advanced to set Intervals per purge part, from 50 to 2,000. Each part is saved to one CSV file and deleted in one step, so a smaller part means more, smaller files and less work in each step. The box shows the saved number, or 2,000 while none is saved; clear it to go back to 2,000. Choose Save part size; it saves on its own and asks for no DELETE, because it changes how a purge runs, not what it deletes. A number outside 50 to 2,000 is refused with what to enter. The part size is on the Plus plan, with purge: on the Free plan it shows with its box off and the Plus notice. Reset to defaults on the Advanced screen puts it back to 2,000.

Summaries#

Open Sojourn Settings, then Summaries under Data.

Roll-up sets Day rows become Month rows after, from 35 to 3,650 days, 400 unless you change it. After a complete purge run, Day rows older than this are removed; their Month rows keep the totals, so reports by month are unchanged, and reports by day reach back this far. The box shows the saved number, or 400 while none is saved; clear it to go back to 400. Choose Save roll-up. A number outside 35 to 3,650 is refused with what to enter. Without purge, as on the Free plan, Day rows are kept.

Rebuild summaries recounts the summary rows of whole months from their Intervals, for example after a backfill. Choose From and To, then Rebuild; the line under the dates names the months it rebuilds. A rebuild is refused for a month a purge has cut into, because its deleted Intervals are no longer there to count, and for a range of more than 9,000 summary rows; rebuild fewer months at a time.

You are done when

  • The Overview no longer asks you to choose retention.
  • With Keep N days, the next morning's Purge Runs list shows a Complete run and its CSV file.

Updated in release 1 This page changes in the same pull request as the feature it describes.