The capture command is the safe starting point when the ServiceNow instance already has configuration you want to bring under manifest review. It reads existing records or exported payloads and writes local artifacts: generated manifests when a converter exists, plus capture-report.md, capture-report.json, and source-inventory.json for everything it inspected.
capture
Create local manifest drafts from existing records, exports, update sets, or app metadata.
sn capture record <table>:<sys_id> --out <dir>
sn capture json <path> --table <table> --out <dir>
sn capture xml <path> --out <dir>
sn capture update-set <sys_update_set_sys_id> --out <dir>
sn capture sys-update-xml --query <encoded-query> --out <dir>
sn capture scope <selector> --calculate-only --out <dir>
sn capture scope <selector> --expand --out <dir>
sn capture sys-app <sys_app_sys_id> --calculate-only --out <dir>
sn capture sys-app <sys_app_sys_id> --expand --out <dir> Read existing configuration and write local capture artifacts.
Arguments
| Name | Required | Description |
|---|---|---|
| source | Yes | A strict record ref, file path, update set sys_id, encoded query, scope selector, or sys_app sys_id depending on the source mode. |
Flags
| Flag | Default | Description |
|---|---|---|
| --out <dir> | — | Directory for generated manifests and reports. |
| --table <table> | — | Required for JSON record input so fields can be mapped to a source table. |
| --query <encoded-query> | — | Encoded query for targeted sys_update_xml capture. |
| --calculate-only | — | Write reports and inventory only; do not emit manifest files. |
| --dry-run | — | Plan output paths without writing final artifacts. |
| --expand | — | For scope and sys-app capture, read supported metadata members as concrete records. Supported manifest converters currently cover script includes, business rules, system properties, flow graphs, and decision tables. |
| --single-manifest / --split-by-scope | — | Control manifest grouping. Update-set, sys-update-xml, scope, and sys-app captures split by scope by default; record/json/xml captures write one manifest unless `--split-by-scope` is provided. |
| --target <name> | — | Select instance from registry. |
| --profile <name> | — | Credential profile under `--target`. |
Examples
sn capture record sys_script_include:11111111111111111111111111111111 --out manifests/captured/helper✓ capture wrote manifests/captured/helper
manifest.ts
capture-report.md
source-inventory.json
sn capture sys-update-xml --query "nameSTARTSWITHsys_script_include_" --calculate-only --out reports/captures/script-includes✓ capture wrote reports/captures/script-includes
capture-report.md
capture-report.json
source-inventory.json
sn capture scope x_acme_app --expand --out manifests/captured/acme✓ capture wrote manifests/captured/acme
manifest.ts
capture-report.md
source-inventory.json
| Source mode | Use it for |
|---|---|
| record | One known live record by `<table>:<sys_id>`. |
| json / xml | Table API JSON, single-record XML, or exported update-set XML files. |
| update-set | Read-only capture from a complete update set by sys_id. |
| sys-update-xml | Targeted bulk capture by encoded query against update XML rows. |
| scope | Metadata inventory for a non-global app scope; add `--expand` to emit supported records. |
| sys-app | Named app/package capture, including custom global bundles addressed by `sys_app` sys_id. |
sn capture scope global is intentionally refused. The platform Global/Global scope is too broad to capture as a scope; use record, XML/JSON, update-set, sys-update-xml, or a named sys-app package instead.
Treat generated manifests as drafts. Review capture-report.md and source-inventory.json, then run preview, preflight, execute, validate, test, and drift before treating captured intent as owned code.