This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Replaces references in a specified field of a specified data item.
This function replaces the existing reference or references contained in the field specified in options.referringItemFieldName
within the data item specified in options.referringItemId
.
The function removes existing references and in their place it adds references to the items specified in options.newReferencedItemIds
.
Note: If you pass an empty array in options.newReferencedItemIds
, all existing references are removed.
You can only call this method when authenticated as a Wix app or Wix user identity.
function replaceDataItemReferences(
options: ReplaceDataItemReferencesOptions,
): Promise<ReplaceDataItemReferencesResponse>;
Options for replacing references.
import { items } from "@wix/data";
async function replaceDataItemReferences(options) {
const response = await items.replaceDataItemReferences(options);
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.