Sub topic 11
Reviewing changes with the Setup Audit Trail
This chapter assumes you can already open Setup, use Quick Find, and read the Setup menu categories from the earlier chapters. You also need a login to a Developer Edition org or a sandbox. Your user needs the View Setup and Configuration permission to see the audit trail. Use an org where you are allowed to make small test changes.
What the Setup Audit Trail is
The Setup Audit Trail is a log of configuration changes made in an org. Each entry records one change: what happened, in which Setup area, when, and who did it. When a page layout changes or a user is frozen, the trail tells you which administrator did it and when.
The trail answers questions such as:
- Who changed this validation rule, and on what date?
- Which permission set did a user receive last week?
- Did a deployment or a managed package change something that nobody did by hand?
The trail records configuration changes only. It does not record changes to business data, such as an edited Account name. Field History Tracking covers that, and so do other tools. Login events are in Login History, not here.
Opening the trail in Setup
- Click the gear icon, then choose Setup.
- In Quick Find, type
View Setup Audit Trail. - Select View Setup Audit Trail under Security.
The page shows the 20 most recent entries. Each row has these columns:
| Column | Meaning |
|---|---|
| Date | The date and time of the change, shown in your time zone |
| Source Namespace Prefix | The managed package that made the change, if one did |
| User | The person whose action caused the change |
| Action | A short description of what changed |
| Section | The Setup area where the change happened |
| Delegate User | An administrator who was logged in as that user, if any |
The Delegate User column matters. When an administrator uses "Login as" to act as another user, the User column shows the user being impersonated. Delegate User shows who was really at the keyboard. Always check it before you blame someone.
Downloading the full history
The page shows only the latest 20 rows. Select Download (the link to export the last six months) to get a CSV file with the full history. Salesforce keeps audit trail data for 180 days. After that, the entries are gone unless you saved them.
Salesforce does not keep this history indefinitely. Export it on a schedule if your company needs a longer record for compliance or incident review. The 180-day limit applies to the Setup page, the CSV download, and the SOQL object.
How the trail fits into your workflow
Reviewing the trail follows a simple pattern. Start with a symptom, narrow the time window, then confirm who made the change.
Querying the trail with SOQL
The same data is available as an object called SetupAuditTrail. You can query it with SOQL, the Salesforce Object Query Language. This is useful when you want to filter or sort by section, or run the same check repeatedly. The query below returns the 20 most recent entries:
SELECT Action, Section, Display, CreatedDate, CreatedBy.Name
FROM SetupAuditTrail
ORDER BY CreatedDate DESC
LIMIT 20Here is what each field gives you:
Actionis a short code for the type of change, such as a created field or a changed permission.Sectionis the Setup area. It matches the Section column on the page.Displayis the readable sentence, for example "Changed profile Sales: ...".CreatedDateis when the change happened.CreatedBy.Nameis the user who made it.
You can run this query in the Developer Console's Query Editor. You can also run it from the CLI. Replace my-dev-org with your org's alias.
sf data query \
--query "SELECT Action, Section, Display, CreatedDate, CreatedBy.Name FROM SetupAuditTrail ORDER BY CreatedDate DESC LIMIT 20" \
--target-org my-dev-orgFiltering by time and section
A broad query is rarely what you need. Add a WHERE clause to narrow it to a window and an area. This example finds user management changes from the last seven days. The exact Section text must match what appears in your org, so run an unfiltered query first and copy a value from the results.
SELECT Action, Section, Display, CreatedDate, CreatedBy.Name, DelegateUser
FROM SetupAuditTrail
WHERE CreatedDate = LAST_N_DAYS:7
AND Section = 'Manage Users'
ORDER BY CreatedDate DESCThe DelegateUser field is the API equivalent of the Delegate User column. Include it whenever you are investigating who made a change.
To save results as a file, add --result-format csv to the CLI command and redirect the output:
sf data query \
--query "SELECT Action, Section, Display, CreatedDate, CreatedBy.Name FROM SetupAuditTrail WHERE CreatedDate = LAST_N_DAYS:30 ORDER BY CreatedDate DESC" \
--target-org my-dev-org \
--result-format csv > audit-last-30-days.csvPractical worked example
Suppose a sales user says the Industry field has vanished from the Account page. You suspect a page layout edit.
- Open the audit trail and look at the latest rows. Nothing relevant appears, because many later changes have pushed the entry down.
- Run a query filtered to the last 14 days and sorted newest first.
- Scan the
Displaycolumn for the words "page layout" or "Account". You find "Changed page layout Account Layout: removed Industry". - Read the user and delegate user. If a delegate user is present, ask that administrator.
- Open Object Manager, then Account, then Page Layouts, and restore the field.
The trail told you who changed the layout, when, and what they did. It did not undo the change. You still have to fix it by hand or from a backup.
Limits and common mistakes
These are the points that most often cause confusion:
- The page shows 20 rows. People often assume nothing older exists. Download the CSV or query the object for the rest.
- It is not a full record of everything. Some changes are not logged, and the log does not store the complete before-and-after state of a configuration. The
Displaytext is a summary, and for some actions it can be truncated. - It does not cover data. A changed Opportunity amount will not appear. Use field history or the record's own history for that.
- It is not a login log. Use Login History for sign-ins.
- Time zones differ. The Setup page shows times in your user's time zone. The API returns UTC. Compare like with like when you merge sources.
- Access is limited. If View Setup Audit Trail is missing from Quick Find, your user lacks the required permission. Ask an administrator, and see the chapter on Setup permissions.
Where the trail sits in the Setup menu
You reached the trail through Quick Find, but it belongs to the Security category of the Setup menu. It is related to the user and access pages you saw earlier, because many of its entries are user, profile, and permission set changes. When you see an unfamiliar Section value, use it as a hint. It names the Setup area, so searching for that name in Quick Find usually takes you to the page that was changed.
Exercise
A colleague asks who deleted a custom field 45 days ago. The View Setup Audit Trail page shows only recent rows. Describe two ways to find the entry, and name one column or field you must check to be sure who made the change.
Show answer
Download the CSV from the View Setup Audit Trail page, which covers the last 180 days, or query the SetupAuditTrail object with SOQL using a WHERE clause on CreatedDate and Section. Check the Delegate User column (the DelegateUser field in SOQL) because an administrator logged in as another user would appear under that user's name.
Exercise
You run the query SELECT Action, Section FROM SetupAuditTrail WHERE CreatedDate = LASTNDAYS:200 and find nothing older than about six months. Why?
Show answer
The Setup Audit Trail retains only 180 days of history, so anything older has been removed. To keep a longer record, download the CSV or export query results regularly and store them yourself.