How to customize options text in relationship field?

default discord avatar
.pixelpoint3 weeks ago
3

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.

  • default discord avatar
    paulpopus3 weeks ago

    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

  • default discord avatar
    .pixelpoint3 weeks ago

    Perfect, thank you very much for very quick response. It helped. I think it would be great mentioning it inside Relationship documentation page.

  • default discord avatar
    paulpopus3 weeks ago

    For sure!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.