Upsert Custom Fields
upsert_custom_fieldsCreate or update custom field definitions by (entity, fieldName) — max 100 per call, case-insensitive match. Check for a built-in first: a custom field is plain data that reorder recommendations, purchasing, pricing, reports and fulfillment never read. Each create names a purpose and a purposeDetail (the user's reason, saved on the field). On an item, a purpose a built-in covers (reorder policy, supplier, category/brand/group, lifecycle, pricing, barcode, tracking, units, dimensions, location, components, tags, notes) is not created: the row comes back needs_review with builtInAlternatives. Show those to the user, and create the field only if they still want it, by resending the row with builtInReviewed=true. fieldName is the upsert identity and never changes once set; omit it on create to derive it from name (snake_case, matching the key the Spark app generates — an all-symbol name fails validation). A supplied fieldName must follow the same convention: lowercase letters, digits and underscores only, starting with a letter or digit. name and type are required when creating; type is IMMUTABLE on update (create a new field instead) and calculated fields cannot be authored here (web app only). Every other property is preserve-on-omit. Options for list/multilist fields are matched by supplied id first, then case-insensitive name — matched options keep their id (and every stored value pointing at it), new names get a generated id, and omitted existing options are REMOVED. itemGroupIds and isCostAttribute only apply to the item entity. validateOnly=true dry-runs every row. Partial success with per-row errors; resubmitting converges. Requires an operator (unpinned) credential — field definitions are tenant-wide schema.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"customFields": "<customFields>"
},
"name": "upsert_custom_fields"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customFields | Yes | Custom-field definition rows to create/update (max 100). entity is required per row; name, type, purpose and purposeDetail are required when creating. | |
| validateOnly | No | true = dry-run: validate + probe every row and report the would-be action per row, writing nothing. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | ||
| total | No | ||
| failed | No | ||
| created | No | ||
| updated | No | ||
| uomsCreated | No | ||
| validateOnly | No | ||
| enabledCustomers | No |