Search
setFields
Add, update, or remove Collection fields.
await collection.setFields([ { id: "1", type: "string", name: "Name" }, { id: "2", type: "number", name: "Age" }, { id: "3", type: "string", name: "Description", userEditable: true }, { id: "specs", type: "array", name: "Specifications", fields: [ { id: "label", type: "string", name: "Label" }, { id: "amount", type: "number", name: "Amount" }, ], }, ])
Fields not included in the array will be removed. You can configure up to 30 custom fields.
Each field requires an id, name, and type. For the id, use a unique identifier that stays the same across future synchronizations. Any change in id can break data assignments on the canvas. The maximum length for an id is 64 characters.
Array fields define their nested schema in fields. Each nested field also requires a stable id, unique within that array field. Include all nested fields to keep; omitted nested fields and their values are removed.
By default, managed collection fields set by a plugin are not editable by users. Set userEditable: true on a field to allow user editing. Note that fields marked as userEditable can no longer have their values set by the plugin when using addItems.
Parameters
fields:ManagedCollectionFieldInput[]– The array of fields that should be used for the collection.
Returns
Promise<void>