import { CollectionConfig } from "payload";
export const Artists: CollectionConfig = {
slug: "artists",
fields: [
{
name: "name",
type: "text",
required: true,
},
{
name: "tracks",
type: "join",
collection: "tracks",
on: "artist",
},
],
};
import {
HTMLConverterFeature,
lexicalEditor,
lexicalHTML,
} from "@payloadcms/richtext-lexical";
import { CollectionConfig } from "payload";
export const Tracks: CollectionConfig = {
slug: "tracks",
admin: {
useAsTitle: "title",
},
fields: [
{
name: "artist",
type: "relationship",
relationTo: "artists"
},
],
};
When I go to assign an Artist to a Track from the Track page, the Track page shows the id of the artist (currently "1" or "2"). I'd like it to instead say the artist.name. I did not see this in the docs, so sorry if I missed it, still learning!
I figured it out. I need to use { admin: useAsTitle: name } } on the Artists collection config
thank you for sharing the solution
Star
Discord
online
Get dedicated engineering support directly from the Payload team.