How to show more information in RelationManager Attach Search.

I have a RelationManager that allows users to Attach records from any of their authorized tenants. I would like to show the tenant name next to the line in the search box so the user knows they're attaching the record from the correct tenant. For example, if both tenants have records called "Corporate Department" I'd like the list in the search box to show as "Corporate Department (Tenant A), Corporate Department (Tenant B).

I tried to use https://filamentphp.com/docs/3.x/panels/resources/relation-managers#searching-the-options-to-attach-across-multiple-columns

but just got an error when i tried to use agency.name as one of my columns (as you would in the table builder).
Solution
Just edited mine to be ...

  Tables\Actions\AttachAction::make()
      ->recordSelectSearchColumns(['name', 'email'])
      ->recordTitle(fn (User $record): string => sprintf('%s - %s', $record->name, $record->email))
Was this page helpful?