👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

How to show chosen technologies in the subtitle field in a Slack thread.

4 replies
Last updated: Feb 9, 2024
defineField({
			name: 'technologies',
			title: 'Technologies',
			type: 'array',
			of: [{ type: 'reference', to: [{ type: 'technology' }] }]
		}),
I am trying to show chosen technologies in the subtitle field but dont know how to. Any tips?


preview: {
		select: {
			customerName: 'customer.name',
			customerImage: 'customer.image',
			technologies: 'technologies.name' // want the names of the technology.
		},
		prepare(selection) {
			const { customerName, customerImage, technologies } = selection;
			const subtitleTechnologies = technologies ? technologies.slice(0, 3).join(', ') : '';

			return {
				title: customerName,
				subtitle: subtitleTechnologies,
				media: customerImage
			};
		}
	}
Feb 7, 2024, 7:16 PM
It looks like you’re on the right track. What’s it currently showing?
Feb 7, 2024, 11:01 PM
[object object] for each technology
Feb 8, 2024, 4:55 AM
OK, I see the problem now. You’re going to have to adjust your select to match this pattern.
Feb 8, 2024, 5:17 PM
Thank you!
Feb 9, 2024, 8:55 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?