
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe issue is that when you're selecting from an array of references, you need to use special syntax to dereference them. Your current approach technologies: 'technologies.name' won't work because technologies is an array of references, not a single reference.
For arrays of references, you need to access individual items by index and dereference each one. Here's how to fix it:
preview: {
select: {
customerName: 'customer.name',
customerImage: 'customer.image',
tech0: 'technologies.0.name', // First technology
tech1: 'technologies.1.name', // Second technology
tech2: 'technologies.2.name' // Third technology
},
prepare(selection) {
const { customerName, customerImage, tech0, tech1, tech2 } = selection;
// Filter out undefined values and join
const technologies = [tech0, tech1, tech2].filter(Boolean);
const subtitleTechnologies = technologies.join(', ');
return {
title: customerName,
subtitle: subtitleTechnologies,
media: customerImage
};
}
}The key points:
technologies.0.name, technologies.1.name, etc. to get the name field from each referenced technology documentselect object, you need to explicitly select each item you want (up to the limit you need).filter(Boolean) to remove any undefined values if there are fewer than 3 technologiesThis approach is documented in the preview configuration documentation, where arrays are accessed using numeric indices like images.0.asset.
If you need to display more than a few technologies or a variable number, you might want to consider using a custom preview component instead, which gives you more flexibility for complex scenarios.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store