forcedotcom/sf-skills / plugins/builder/dx-org-lifecycle/skills/automation-sandbox-post-copy-configure
automation-sandbox-post-copy-configure
VerifiedApply 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.3 KB |
| assets/api_request_templates.json | config | 4.2 KB |
| examples/sample_config_input.json | config | 1.1 KB |
| examples/sample_execution_summary.md | markdown | 4.0 KB |
| references/api_endpoints.md | markdown | 10.7 KB |
| references/authentication.md | markdown | 2.9 KB |
| references/execution_phasing.md | markdown | 3.6 KB |
| references/flow_activation_path.md | markdown | 7.1 KB |
| references/rules_gotchas.md | markdown | 3.5 KB |
| references/scheduled_apex_path.md | markdown | 8.1 KB |
| scripts/build-scheduled-apex.mjsexecutable | script | 2.2 KB |
| scripts/classify-patch-result.mjsexecutable | script | 3.1 KB |
| scripts/map-metadata-key.mjsexecutable | script | 3.4 KB |
| scripts/plan-phases.mjsexecutable | script | 2.8 KB |
| scripts/resolve-target-org.mjsexecutable | script | 1.9 KB |
| scripts/soql-escape-job-name.mjsexecutable | script | 1.0 KB |
references/execution_phasing.md
View on GitHub# Execution Phasing
The `ExecutionOrder` field in each config entry is a **phase number**,
not a per-row counter. This file explains the model; the deterministic
enumeration is owned by `scripts/plan-phases.mjs` (authoring standard
A9). Invoke that script and consume its `phases[]` output directly —
do not re-implement the grouping rule in prose.
## Grouping rules (implemented in `scripts/plan-phases.mjs`)
1. Read every entry from the config JSON.
2. Bucket entries by their `ExecutionOrder` integer value.
3. Sort buckets ascending — the phase with the smallest
`ExecutionOrder` runs first.
4. Assign each bucket an `ordinal` = 1-indexed position in the sorted
list. Sparse values (`1, 2, 5`) collapse to (`1, 2, 3`) — no empty
phases for the gaps.
Example — a config with these values:
```text
Entry A: ExecutionOrder = 1
Entry B: ExecutionOrder = 1
Entry C: ExecutionOrder = 2
Entry D: ExecutionOrder = 1
Entry E: ExecutionOrder = 5
```
...produces three phases:
```text
Phase 1 (ExecutionOrder = 1): [A, B, D] ← parallel-eligible
Phase 2 (ExecutionOrder = 2): [C] ← runs after Phase 1 completes
Phase 3 (ExecutionOrder = 5): [E] ← runs after Phase 2 completes
```
The absolute value of `ExecutionOrder` is not meaningful — a jump from
2 to 5 does not imply three empty phases. Only the ordering matters.
## Intra-phase concurrency
Entries within a single phase are eligible to run in parallel. The
concurrency cap is **5 by default** to avoid tripping Salesforce API
rate limits (`REQUEST_LIMIT_EXCEEDED`, HTTP 429).
- If the phase has ≤5 entries: run them all concurrently.
- If the phase has >5 entries: run them in batches of 5, waiting for
each batch to complete before starting the next.
On any HTTP 429 within a phase, reduce the concurrency for the
remainder of the run (5 → 2) and continue. Do not abort — the cap can
recover on the next phase.
## Phase boundaries — strict serialization
Never overlap phases. Every entry in Phase N must have a terminal
outcome (SUCCESS, FAILED, NOT_FOUND, SKIPPED, DRY_RUN,
DELETE_NOT_SUPPORTED, UNSUPPORTED_CONFIGURATION_NAME) before any entry
in Phase N+1 starts.
Rationale (from the design doc v264 execution model):
> "Since we might not be able to copy or perform tasks in any order as
> there might be tasks which will be dependent on others… Stage 2:
> tasks in parallel, each waits for ALL of Stage 1."
A later phase may depend on the effect of an earlier phase — e.g.,
Remote Site Settings must be updated before the Outbound Messages that
target hosts covered by those Remote Sites are re-activated. Skipping
the barrier means the later phase sees stale state.
## Handling failures across phases
- **Default (`continue-on-error = true`)**: A phase completes even if
some entries fail. The next phase still starts. All failures are
captured in the summary.
- **Strict (`continue-on-error = false`)**: The first failure inside
a phase aborts the current phase mid-flight (the remaining
parallel-eligible entries in that phase are cancelled) and blocks
every subsequent phase. Emit `NOT_ATTEMPTED` outcomes for the
cancelled and blocked entries.
- **`NOT_FOUND` is treated as a failure** for the purposes of the
continue-on-error flag — the customer typically wants to know
their config referenced a record that does not exist on the target
org.
## Empty phases and duplicate ExecutionOrder
- **All entries share the same `ExecutionOrder`**: one phase, all
parallel-eligible. This is the common case for small configs and is
perfectly valid.
- **`ExecutionOrder` is missing or non-integer on any entry**: treat
the config as malformed and abort before Step 2 of the workflow.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |