isReferenced( )


Developer Preview

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

Checks if a reference to the referenced item exists in the specified field of the referring item.

The isReferenced() method returns a Promise that resolves to true if the referring item contains a reference to the referenced item in the specified field. The Promise is rejected if the current user does not have read permissions for the collection.

Note: The isReferenced() method is not supported for single-item collections.

Permissions
Read Data Items
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
dataCollectionIdstringRequired

ID of the collection containing the referring item.


fieldstringRequired

Field to check for a reference to the item that might be referenced.


referringItemunionRequired

Referring item.


referencedItemunionRequired

Item that might be referenced.


optionsWixDataReadOptions

Options for checking whether a field contains a reference to an item.

Returns
Return Type:Promise<boolean>

This example checks if the item in the Movies collection with the ID 00001 has a reference in its Actors field that refers to an item with the ID 12345

JavaScript
Errors

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

Did this help?