Start free
Andrew Hanna

Andrew Hanna

How to Set Up Approval Gates and Audit Trails for Salesforce Deployments

How to Set Up Approval Gates and Audit Trails for Salesforce Deployments

Short answer: an approval gate is a rule that blocks a promotion until a named person who is not the author signs off. It becomes an audit trail when the approval is recorded against the exact commit and target org, and cannot be edited afterwards. Configure that once per environment and you stop assembling screenshots forever.

What makes an approval gate auditable?

A gate that only exists in someone's habits is not a control. Four properties turn it into evidence:

  • Enforced. The promotion is technically impossible without the approval, not just discouraged.
  • Attributed. The approver is an authenticated identity, not a name typed into a ticket.
  • Bound. The approval points at a specific commit and a specific target org, so it cannot be reused for a different payload.
  • Immutable. Nobody, including admins, can edit the record after the fact.

If any one is missing, an auditor will treat the whole control as unreliable, however good the process looks on a slide.

Who should approve what, at which environment?

Most teams either gate nothing or gate everything, and both fail. Gate by risk, and write it down:

  • Feature or scratch org: no gate. Speed matters more than control here, and nothing downstream trusts it.
  • Integration or QA: automated checks only. Tests, coverage and static or AI code review must pass. No human sign-off.
  • UAT or staging: one human approver, typically the tech lead, plus the automated checks. This is where design mistakes are still cheap.
  • Production: two approvers. A technical reviewer who is not the author, plus the business owner of the affected process. Add a release window so approvals cannot be collected at 23:00 on a Friday.
  • Production hotfix: one approver, with a mandatory retrospective work item inside 24 hours. Define the path rather than pretending it will not be used.

Two approvals at production is not bureaucracy. It is the smallest configuration that satisfies separation of duties under SOX-style testing, and it costs about five minutes.

How do you configure the gates?

  1. Take deploy rights off humans in production. Only the pipeline's integration identity holds Modify Metadata and Modify All Data there. This single change makes every other gate real, because there is no way around it.
  2. Turn on branch protection for the branch that maps to production. Require pull requests, require at least one approving review, and disable self-approval.
  3. Make the checks required, not advisory. Apex tests, coverage threshold, static analysis or automated code review must be blocking status checks. A check that can be ignored is not a gate.
  4. Add an environment-level approval for production. Branch protection covers the merge; the environment gate covers the deploy. You want both, because they answer different auditor questions.
  5. Dismiss stale approvals on new commits. Otherwise an approved pull request can be amended after sign-off, which quietly breaks the binding property above.
  6. Name the approver groups by role, not by person. People leave. Roles are what the auditor samples against.

Every mainstream Salesforce DevOps platform supports this pattern, including Copado, Gearset, AutoRABIT, Flosum, Blue Canvas and Serpent, as does plain GitHub or GitLab in front of the CLI. The configuration is what matters, not the badge on it.

What must the deployment record contain?

When an auditor samples ten releases, each one should resolve to a single record carrying:

  • The work item and its business reason.
  • The commit SHA and the metadata diff.
  • The approver identities, with timestamps, and whether the author is among them.
  • The test result and coverage at the time of the deploy, not today's number.
  • The target org, the deploy ID and the outcome, including partial failures.
  • Any exception flag, such as a break-glass release.

Store that outside the org. Records that live only inside Salesforce expire, and audit cycles are annual.

Why native Salesforce logs are not enough on their own

They are worth enabling, but know the edges:

  • Setup Audit Trail keeps 180 days, shows only the most recent entries in the UI, and does not record before and after values. Download the CSV on a schedule or query the SetupAuditTrail object.
  • Field History Tracking is capped at 20 fields per object, retains roughly 18 months in the UI and 24 via the API, and cannot track formula, roll-up summary or auto-number fields. Field Audit Trail with Shield extends retention through a policy.
  • Neither tells you whether a change was approved. They record that something changed, not that it was allowed to.

That last line is the reason the pipeline record is the primary evidence and the org logs are corroboration.

How do you stop changes that bypass the gate?

The most common finding is not a bad approval, it is a change that never went through the pipeline at all: an admin editing a validation rule in production at 16:00 on a Tuesday. Close it with three habits.

  1. Run drift detection on a schedule and compare the production org against the branch. Anything present in the org and absent from Git is either an unapproved change or a gap in your capture.
  2. Reconcile against Setup Audit Trail weekly. Every entry should map to a deployment or a documented exception.
  3. Treat repeated drift as a process bug. If admins keep going around the pipeline, the pipeline is too slow for the work they do. Fix the friction, not the people.

Get those three running and the annual audit stops being a project. More setup guides like this one are in our SF Guides library.

FAQ

How many approvers does a production deployment need?

Two is the practical standard: a technical reviewer who is not the author, plus the business owner of the affected process. One is enough for a documented hotfix.

Can the person who wrote the change approve it?

No. That breaks separation of duties and is the first thing an auditor tests. Disable self-approval in branch protection so the rule is enforced, not remembered.

Do approval gates slow releases down?

Rarely, if you gate by environment. Lower environments stay ungated with automated checks only, so the human step happens once, at the point where a mistake is actually expensive.

Is Setup Audit Trail enough evidence on its own?

No. It keeps 180 days, omits before and after values, and shows that a change happened but not that it was approved. Use it to corroborate your pipeline records.

Related Articles

Curious about faster shipping before you dive in? Let's talk

Commitment free!