Records with same name but different slugs are grouped in relationship dropdowns

Hello, Forest Admin Team,

I’m facing an issue with how relationship data (BelongsTo) is being displayed.

have a model (let’s call it ModelA) that has both a name and a slug field. In my database, I have multiple records that intentionally share the same name but have unique slugs (and unique IDs).

[
{ “id”: 1, “name”: “Example Category”, “slug”: “example-category-a” },
{ “id”: 2, “name”: “Example Category”, “slug”: “example-category-b” }
]

I have another model (ModelB) that has a belongsTo relationship with ModelA.

When I edit a ModelB record and click the dropdown to select a related ModelA, Forest Admin “groups” these results. It shows me two identical options, both labeled “Example Category”. This makes it impossible for me to know which record has the “example-category-a” slug versus the “example-category-b” slug.

Hello @Caio_Fernandes and welcome to the community !

To improve visibility/navigation through your data in Forest Admin, you can change the reference field configured for your ModelA collection. Setting the unique slugs as reference field will allow you to distinguish them.

If a single field is not sufficient information, you can create a field which combines multiple fields and then have it set as the reference field.

I hope this helps, for more information sharing your project name would allow me to give more detailed support.

Best regards,

2 Likes