I'm trying to use PayloadCMS with Postgres and stuck on relationship type of field. When I use it, it uses a primary key "id" as a text for options inside the dropdown, when I want title to be used instead. It feels like a bug specifically with Postgres, since based on all examples availalbe there should not be any extra code, however anyway I can't find a way to customizing these texts since it also feels like quite an obvious feature.
In your referenced collection are you setting up your
admin.useAsTitle
configuration?
https://payloadcms.com/docs/configuration/collections#admin-options
this is what tells the cms what field it can use as a preview/title
Perfect, thank you very much for very quick response. It helped. I think it would be great mentioning it inside Relationship documentation page.
For sure!
i get this error:
'useAsTitle' does not exist in type 'Admin'
how did you implement it @pixelpoint ?
this is my config:
{
name: 'artist',
label: 'Artist',
type: 'relationship',
relationTo: 'artists',
admin: {
sortOptions: 'name',
useAsTitle: 'name',
},
},
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.