Some errors are received during data exchange between the systems, and some Salesforce-only errors are stored as records of the custom Log object. The Scope field contains the ID of the Referral record that had an error occur. The Message field contains the message if one was returned in the response. The Detail field contains the full error stack trace.

The following issues are recorded as Log records:

  1. For outbound requests, all errors are logged.
  2. For inbound requests:
    1. Insufficient access errors are logged.
    2. Database-level errors are logged.
    3. Anything else (e.g. bad payload, incorrect IDs) is NOT logged.

1. Configure the purge job for Logs

Since Logs are stored as records of a custom object, they consume storage space like any other record in Salesforce. In order to lower the storage load, you can configure a packaged purge job, which consists of two parts.

1.1. Define the retention period

The OOTB retention period is 180 days. This means the purge job will delete all Log records with Log Date >= 180 days. If that is fine with you, then you can skip scheduling the purge job.
If you want to change the retention period, then go to Setup > Custom Settings and click Manage next to “Data Purge Settings”.


On the next page, you’ll see the current retention period. Click Edit if you want to change it.

On the next page, only change the Retention Period (days) value and nothing else. Click Save.

1.2. Schedule the purge job

The actual purging is done by an apex job that you need to schedule first. For that, go to Setup > Apex Classes and click Schedule Apex at the top of the table.

On the next page, enter a descriptive job name and “AqDataPurgeBatchScheduler” for the Apex Class. Select how often you want the job to run and at what time (see more details here). We recommend starting with once a week on a Sunday night, but you can change it later if you see that it’s not adequate for how fast your org accumulates Log records. Click Save.

To monitor the job, change its settings or delete it, go to Setup > Scheduled Jobs. Find the job name in the list, and click Manage or Del next to it.


0 out of 0 found this helpful



Article is closed for comments.