Does anyone know of a way that you can search by a field other than the title when selecting a record from a relationship field select dropdown?
In my example, I want to associate related "Fixtures" to one another, but I'd like the ability to search not only by the
title, but also by the
partNumberfield. I can make this happen on the collection list page (by way of
listSearchableFieldsin my collection declaration, but this doesn't seem to carry over to the select dropdown.
Any ideas?
Currently that is not possible. This would be a great feature to add.
I would make it so that the relationship field has an
adminproperty called
searchFieldor similar that would take the path of the thing to search on.
Then the relationship field input could use that instead of the
useAstitlefield when the config option is present.
One thing that complexifies this a bit is that having multiple
relationTofor different collection would need their own search fields. That leaves a lot of room for error, so maybe better to have it on the collection as a sibling to
listSearchableFields. I'm thinking out loud.
The next step is to create a Github discussion for a new feature request where these details are figured out and somebody can go on to code it.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.