Hi, i have a collection ‘layout’ with a block ‘review’. The review block has a relationship field ‘items’ to a collection called 'reviewItems'.
I want the relationship field 'items' to be always up to date with all items from the 'reviewItems' collection. I partially managed that by fetching all reviewItems in the
defaultValueoption. However, if i add more items to the reviewItems collection, i will have to add these manually.
I want to achieve this because i’ll be using the review block on multiple pages and it has to contain the same items on every page. Thanks!
TLDR: Is it possible to make a relationship field that automatically contains all items from a collection.
Hi
@936926437473144864you could add a field hook that makes a request your
reviewItems
collection and returns all items. There is more info on field hooks here
https://payloadcms.com/docs/hooks/fieldsLet me know if you still need help here!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.