bulkPatch( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Creates a bulk patch to modify the specified items. Unlike bulkUpdate(), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged.

The bulkPatch() method builds a bulk patch to modify multiple data items in a collection. It returns a WixDataBulkPatch object that contains the bulk patch definition, which you can further refine by chaining WixDataBulkPatch methods onto it. These methods allow you to clear, set, and increment field values, as well as add or remove items from array fields. The methods are applied in the order in which they are chained.

Finally, to run the bulk patch, chain run() as the last method.

Calling the bulkPatch() method triggers the beforeUpdate() and afterUpdate() hooks for each patched item, if the hooks have been defined.

Notes:

  • This method does not support multi-reference fields. For multi-reference fields, use insertReference() or replaceReferences().
  • This method is limited to 100 items per method call.
  • You can only patch items in collections created by Wix users. Items in Wix app collections cannot be patched.
  • Translatable collections do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling bulkPatch() fails and issues an error.
  • When an item is patched, its data._updatedDate field is updated to the current date and time.
  • The maximum size of a patched collection item is 500kb.
  • If an item ID isn't found, the errors array in the response returned by run() contains a corresponding item with details about the error. Learn more about Wix Data Error Codes.
Permissions
Write Data Items
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
dataCollectionIdstringRequired

ID of the collection that contains the items to patch.


itemIdsArray<string>Required

IDs of the data items to patch.

Returns
Return Type:WixDataBulkPatch
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?