User matching
User matching
This page is for anyone writing a users definition file or a --user expression. Provisioning and the lifecycle commands that read users-def.json share one matching layer, which finds existing Salesforce User records before Warden plans any write or action. A users definition (--users-def) is a JSON or CSV file that lists the users to act on; see Command details for the format.
Match fields
- A match field is any
Userfield that describe metadata marksfilterable. Names are case-insensitive and resolved to the canonical API name. - Provisioning:
--external-idsets the default match field, and--match-fieldis an alias. A user’s ownmatchkey overrides it for that row. - Lifecycle commands:
--external-idsets the default forusers-def.json, and a per-entrymatchkey overrides it.--user field:valuetakes any filterableUserfield, orId, directly. User-audit mode inaccessworks the same way. - With no match field, provisioning treats the row as a new user. A lifecycle command reports a target error. A missing match value is always an error.
Exact matching is case-insensitive. If nothing matches, the request is reported as unmatched. If more than one record matches, it is skipped as ambiguous. Warden never treats an ambiguous match as an insert, and never applies it to several users.
Fuzzy Username matching
Fuzzy matching is opt-in and works only when the match field is Username. It finds the base Username and any Username with a Salesforce sandbox suffix, like this:
Username = base OR Username LIKE base.%The base is compared case-insensitively after the query. SOQL wildcard characters and backslashes in the base are escaped. Large batches are split to stay within the query length limit.
- Provisioning:
--fuzzy-usernameturns it on for every row. A row can set"fuzzyUsername": trueinusers-def.json, and that takes precedence, sofalseopts one row out. The key does nothing for other match fields. - Lifecycle commands: entries in
users-def.jsoncan setfuzzyUsername: true. There is no global--fuzzy-usernameflag, and--user field:value(also inaccess) never uses fuzzy matching.
Examples
Provision with fuzzy Username matching:
{ "users": [ { "personas": ["standard"], "match": "Username", "fuzzyUsername": true, "Username": "alex@example.com" } ]}Lifecycle commands use the same per-entry shape:
sf warden freeze --users-def ./users.json --target-org mySandboxFor provisioning merge and precedence rules, see command details. For every flag, see the CLI reference.