# summary

Preserve profiling definitions as portable CSV files before sandbox refreshes, package upgrades, or cross-org migrations — so hours of scoping work are recoverable in seconds.

# description

Profiling definitions represent hours of scoping work — object selection, method assignment, category classification, field configuration. That configuration exists inside the Salesforce org and a sandbox refresh removes it. This command extracts all profiling definitions and writes them to a self-contained export directory for backup, migration, or version control.

The export creates a timestamped directory containing three files:

- `export.json` — SFDMU configuration file for round-trip compatibility with `definition import`
- `pnova__Profiling_Definition__c.csv` — all definition records (fields covering identity, aggregation status, version tracking, profiling configuration, and formula fields)
- `export-metadata.json` — source org, timestamp, record count, and file manifest

This command exports OUT of the org. To bring definitions back IN, use `sf cuneiform definition import`.

WHEN TO USE:

- Before a sandbox refresh — preserve definitions so you can restore after the refresh wipes custom data
- Before a package upgrade — capture the current configuration in case the upgrade affects profiling definitions
- For cross-org migration — export from sandbox, review the CSV in a spreadsheet, import to production
- For version control — commit definition exports to Git with `--exclude-ids` for clean diffs between versions

The `--exclude-ids` flag strips Salesforce-generated IDs (Id, CreatedById, LastModifiedById) from the CSV output. This produces clean diffs between exports — org-specific IDs create false diffs in version control.

Read-only. Does not modify definitions in the org. Fails if the output directory already exists, preventing accidental overwrites of previous exports.

# flags.target-org.summary

Export definitions from this Salesforce org. Specify the org alias or username when you have multiple authenticated orgs.

# flags.output.summary

Override the default timestamped output directory. Defaults to `./data/exports/definitions/{timestamp}`, creating a unique directory per export. Specify a custom path to organize exports within a project structure (e.g., `--output ./config/definitions`).

# flags.exclude-ids.summary

Strip Salesforce-generated IDs (Id, CreatedById, LastModifiedById) from the CSV output. Use this when committing exports to Git — org-specific IDs differ between environments and create false diffs. Keep IDs when exporting for same-org restore fidelity.

# spinner.exporting

Exporting definitions...

# export.complete

Exported %s definition(s) successfully.

# output.directory

Output directory: %s

# table.header.file

File

# table.header.path

Path

# warnings.title

Warnings

# examples

- Back up all definitions before a sandbox refresh:

  <%= config.bin %> <%= command.id %> --target-org myOrg

- Save to a specific directory within your project structure:

  <%= config.bin %> <%= command.id %> --target-org myOrg --output ./backup/definitions

- Export for Git — strip org-specific IDs so diffs reflect only meaningful configuration changes:

  <%= config.bin %> <%= command.id %> --target-org myOrg --exclude-ids --output ./config/definitions

- Export for cross-org migration — keep IDs for exact restore fidelity in the target org:

  <%= config.bin %> <%= command.id %> --target-org myOrg --output ./migration/source-org

- Output as JSON for scripting, automation pipelines, or downstream tooling:

  <%= config.bin %> <%= command.id %> --target-org myOrg --json
