# Automation Sandbox Post Copy Configure

Apply a Salesforce sandbox post-copy automation JSON config against a target org.

- Repository: https://github.com/forcedotcom/sf-skills (1134 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add forcedotcom/sf-skills --skill automation-sandbox-post-copy-configure -g -a claude-code -y`
Codex: `npx skills add forcedotcom/sf-skills --skill automation-sandbox-post-copy-configure -g -a codex -y`
Cursor: `npx skills add forcedotcom/sf-skills --skill automation-sandbox-post-copy-configure -g -a cursor -y`
Gemini CLI: `npx skills add forcedotcom/sf-skills --skill automation-sandbox-post-copy-configure -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add forcedotcom/sf-skills`

## Description

Apply a Salesforce sandbox post-copy automation JSON config against a target org. Use when the user asks to apply, run, execute, dry-run, or preview a post-copy or post-refresh config file (e.g. `post-copy-config.json`) against a sandbox, including activating/deactivating a Flow (PATCH `FlowDefinition.Metadata.activeVersionNumber` to the version, or `null`), re-pointing an OBM endpoint, updating a RemoteSiteSetting URL, or re-scheduling a ScheduledApex job after refresh. Also trigger for phrasings like \"apply post-copy config\", \"run post-copy automation\", \"activate Flow <name> post-refresh\", \"deactivate Flow <name>\", \"re-point outbound messages after refresh\", or \"configure sandbox after refresh\". Per entry, derive the Tooling API sobject, verify via describe, resolve the Id via SOQL, then PATCH the compound `Metadata` field (`ScheduledApex` uses anonymous Apex). DO NOT TRIGGER for generating config JSON from an SOP (use `automation-sandbox-post-copy-config-generate`) or for deploying metadata XML.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Automation: Sandbox Post-Copy Configure

Apply a Salesforce sandbox post-copy automation JSON config to a target
org. Four canonical `ConfigurationName` values are pinned:
`OutboundMessages` + `RemoteSiteSettings` → compound-`Metadata` PATCH
(Steps A, E); `ScheduledApex` → anonymous-Apex (Step F) since
`CronTrigger` is read-only; `Flows` → flow-activation (Step G), same
compound-`Metadata` transport as A, E with fixed mutation key
`activeVersionNumber` + state-aware pre-flight (`ALREADY_ACTIVE` /
`ALREADY_INACTIVE`). Non-canonical names are derived + describe-verified.
Every A, E entry must pass Step B (describe 200 + `Metadata` compound
field) before any PATCH is planned; Step B skipped for `ScheduledApex`.
Unverified entries are surfaced in the summary and skipped, never
guessed at.

## Tool Restrictions

**Use ONLY the Bash tool** to execute `sf` CLI commands (`sf data query
--use-tooling-api`, `sf api request rest`, `sf org display`). Do NOT
use MCP tools like `execute_soql`, the compound `Metadata` PATCH
pattern this skill requires is not available through MCP wrappers.
Invoke `sf` **without** `--target-org` when the user didn't name an
alias (the harness sets the CLI default); never pass `--target-org
default` (`NamedOrgNotFoundError`). SOQL-over-REST is same-OAuth, no direct DB / non-Salesforce SQL access.

## STOP, do this before making any API call

Never call the org from memory. Before the first request:

The rest: https://github.com/forcedotcom/sf-skills/blob/HEAD/plugins/builder/dx-org-lifecycle/skills/automation-sandbox-post-copy-configure/SKILL.md
