sndev.io / docs

modify-xml

Patch fields inside an exported XML — rewrite scope, rename a flow, set arbitrary field values.

modify-xml applies targeted rewrites to a canonical ServiceNow XML export without re-importing it first. Useful when moving an update set between scopes, duplicating a flow under a new name, or bulk-setting a single field across a table. Operations are applied in the order listed; multiple ops chain.

sn modify-xml <input.xml> <output.xml> [ops...]

Rewrite fields inside an XML export.

Arguments

NameRequiredDescription
input.xmlYesSource XML file to read.
output.xmlYesDestination path for the rewritten XML.

Flags

FlagDefaultDescription
--scope <value>Rewrite `sys_scope`, `sys_package`, and `application` fields.
--set <table>:<field>=<value>Rewrite `<field>` inside `<table>` blocks only.
--set <field>=<value>Rewrite every occurrence of `<field>` in the file.
--rename-flow <name>Rewrite `name`, `internal_name`, and `sys_name` on every `sys_hub_flow` payload. Auto-slugs `internal_name` unless overridden.
--internal-name <slug>Explicit `internal_name` to pair with `--rename-flow`.

Examples

sn modify-xml orig.xml scoped.xml --scope x_acme_hr
Rewrote 14 scope references → scoped.xml
sn modify-xml orig.xml renamed.xml --rename-flow "HR Onboarding v2"
Rewrote 3 sys_hub_flow records:
name=HR Onboarding v2
internal_name=hr_onboarding_v2
sys_name=HR Onboarding v2