Guides / n8n × Salesforce / Data Validation

Fix n8n + Salesforce INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: Bad Value for Restricted Picklist

Salesforce restricted picklists reject any value not in their defined set. n8n usually sends the label, the wrong case, a trailing space, or a value not enabled for the record type. Send the exact API value, case-sensitive, mapped to the record type.

Comparison graphic of a wrong-case picklist label versus the exact Salesforce API value, with a record-type availability note, for an n8n restricted-picklist error.
A Salesforce create or update from n8n fails with INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: bad value for restricted picklist field: <value>.
Short answer: A restricted picklist in Salesforce accepts only the values in its defined value set — anything else is rejected, and the API enforces it. From n8n the usual causes are: sending the picklist label instead of its API value, a case mismatch (picklist values are case-sensitive), a leading or trailing space, or a value that exists globally but is not enabled for the target record type. Fix it by reading the field's valid API values (and the per-record-type subset), mapping your source data to exactly those strings, trimming whitespace, and matching case precisely. If a genuinely new value is needed, add it to the value set in Salesforce first.

What 'restricted' means here

A Salesforce picklist can be restricted or unrestricted. An unrestricted picklist quietly accepts a value that is not in its list (it just stores it). A restricted picklist enforces its value set: an API write with a value outside that set fails with INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST. Multi-select restricted picklists behave the same way for each value in the selection.

Record types add a second layer. The same field can expose different subsets of the global value set to different record types. A value can be perfectly valid globally and still be rejected because it is not among the values enabled for the record type of the record you are creating or updating.

Salesforce matches on the value's API name, and it is case-sensitive and space-sensitive. 'Closed Won', 'closed won', and 'Closed Won ' (trailing space) are three different strings, and only one is the real value.

The rejection is exact-string, case-sensitive, and scoped to the record type. 'Looks right' is not enough — it has to be the precise API value enabled for that record type.

Confirm the field's real values

Get the field's value set from Salesforce rather than guessing. A describe call on the object (or the Setup screen for the field) lists each picklist entry with its API value, its label, whether it is active, and — per record type — whether it is available. Use the API value, not the label. Labels are frequently changed for the UI while the underlying value stays the same.

If the object uses record types, get the record-type-specific picklist values too, because that subset is what actually applies to your write. The value your data has might be active globally but not assigned to the record type you are targeting.

Write down the mapping from every value your source system can produce to the exact Salesforce API value. Include an explicit 'no match' outcome so unmapped values are caught in n8n instead of failing at Salesforce.

  • Use the field's API value, not its display label.
  • Check the per-record-type available values, not just the global set.
  • Confirm the value is active (inactive values also reject).

What not to do

Do not un-restrict the picklist to make the error go away. That lets bad values flow into Salesforce permanently and breaks reports, validation, and downstream automation that assume a clean value set.

Do not blank the field to dodge the error unless blank is genuinely correct. Sending null to a required restricted picklist just changes the error to a missing-required-field failure.

Do not add every possible source value to the Salesforce value set to force a match. That pollutes the picklist with near-duplicates ('USA', 'U.S.A.', 'United States') and defeats the point of restricting it. Map instead.

The fix: map, trim, match case, respect the record type

In n8n, put a mapping step (a Set node with an expression, or a small Code node with a lookup object) between your source data and the Salesforce node. It converts each incoming value to the exact Salesforce API value, trims whitespace, and normalises case to match. Any value that does not resolve is routed to an error branch, not sent onward.

If your write specifies a record type (or the object has a default record type for the integration user), make sure every mapped value is one that is enabled for that record type. If you need to support several record types, the mapping has to be record-type-aware.

When the business really does need a value Salesforce does not have yet, the correct fix is to add it to the field's value set in Salesforce (and enable it for the relevant record types) before the workflow sends it. That is a Salesforce config change, not something to work around in n8n.

// n8n Code node: normalise to the exact Salesforce API value
const valueMap = {
  'won': 'Closed Won',
  'closed-won': 'Closed Won',
  'lost': 'Closed Lost',
  'in progress': 'Working',
};
const raw = (($json.stage || '') + '').trim().toLowerCase();
const sfValue = valueMap[raw];

if (!sfValue) {
  // route to an error branch — do NOT send an unmapped value to Salesforce
  return [{ json: { error: 'unmapped picklist value', raw: $json.stage } }];
}
return [{ json: { StageName: sfValue } }];   // exact API value, correct case

Verification

Take the exact value from your last failing payload and compare it character by character with the field's API value from a describe call: case, spaces, punctuation. The difference is almost always one of those.

After adding the mapping, run a record for each distinct source value you expect and confirm each one writes successfully. Then send a deliberately unmapped value and confirm it lands in your n8n error branch and never reaches Salesforce.

If record types are involved, run one record per record type and confirm the mapped value is accepted for each. A value that passes for one record type and fails for another means the mapping is not record-type-aware yet.

  • Failing value differs from the API value only by case, spaces, or punctuation.
  • Every expected source value now writes successfully.
  • An unmapped value is caught in n8n, not by Salesforce.
  • Mapped values are accepted for every record type you target.

Getting the authoritative value set, per record type

Two endpoints give you the real answer, and they answer different questions. The object describe returns every picklist entry on the field with its API value, its label, whether it is active, and whether it is the default — the global value set. That is what you need for building a mapping table, and it is the one to read first.

The UI API picklist-values endpoint answers the question that actually matters at write time: which of those values are available for this specific record type. A field can carry forty values globally while a given record type exposes eight, and a write of one of the other thirty-two is rejected even though every describe you looked at said it was valid. If your object uses record types at all, this is the endpoint to build the mapping from.

The master record type has a fixed, well-known ID — 012000000000000AAA — which is what to use when an object has record types defined but your integration writes against the default. Cache both responses; picklist value sets change on the timescale of admin work, not on the timescale of workflow runs, and fetching them per item burns API calls to learn something that did not change.

# Global value set for the field
GET /services/data/v62.0/sobjects/Opportunity/describe
Authorization: Bearer ACCESS_TOKEN

# -> fields[].name = "StageName"
#    fields[].restrictedPicklist = true
#    fields[].picklistValues = [
#      { "value": "Closed Won",  "label": "Closed Won",  "active": true,  "defaultValue": false },
#      { "value": "Needs Review","label": "Needs Review","active": false, "defaultValue": false }
#    ]
#    active:false values are rejected exactly like unknown ones.

# What this RECORD TYPE actually allows — the set that governs your write
GET /services/data/v62.0/ui-api/object-info/Opportunity/picklist-values/012xx0000001AAA/StageName

# -> { "values": [ { "value": "Prospecting", "label": "Prospecting" },
#                  { "value": "Closed Won",  "label": "Closed Won" } ] }
#    012000000000000AAA is the fixed id of the Master record type.

Where these facts come from

Salesforce Help documents the 'bad value for restricted picklist field' error and its causes: value not in the set, case mismatch, and record-type restrictions. Third-party guides on INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST document the same causes for API and middleware integrations, including sending the label instead of the API name. n8n's Salesforce node documentation covers field mapping.

Frequently asked questions

Should I send the picklist label or the API value?

The API value, matched exactly for case and spacing. Labels are often changed for the UI while the API value stays the same, so sending the label is a common cause of INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST.

The value works in the Salesforce UI but the API rejects it — why?

Usually a record-type restriction. The value is in the global value set but is not enabled for the record type of the record your workflow is writing. Check the per-record-type available values and map accordingly.

Can I just make the picklist unrestricted?

You can, but then Salesforce silently stores any value, which breaks reporting, validation rules, and downstream automation that rely on a clean set. Map your source values to the allowed set in n8n instead.

What if the business needs a value Salesforce does not have?

Add it to the field's value set in Salesforce (and enable it for the relevant record types) before the workflow sends it. That is a Salesforce configuration change; do not try to force it through from n8n.

The value is in the field's picklist but still rejected.

Check two things the object describe will not tell you on its own: whether the entry is active, and whether it is enabled for the record type you are writing to. The UI API picklist-values endpoint for that record type returns the set that actually governs the write.