Imagine I have a Collection called Users, with the fields Name(text) and Products(relationTo='products') (read-only).
And I also have a collection named Products with the fields Name (text) and Consumers(relationTo='users').
Is it possible to auto fill the read-only products fields in the users collection by providing this information in the Consumers field of the Products collection?
Thanks in advance
You can use hooks to fill out the read-only field. To manipulate other collections, you can use the locale API.
Hi @tonigalii! As @Trstly said, yes you can absolutely achieve this using field / collection hooks.
Here is an example where we use hooks to populate fields:
https://github.com/payloadcms/payload/blob/master/examples/virtual-fields/src/collections/Location.tsAnd hooks documentation:
https://payloadcms.com/docs/hooks/overview#hooks-overview@jesschow thanks for sharing this 😄
I had the same problem
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.