F
Filament15mo ago
Zetto

Attach with relationship showing different search option label

I have table A with name that has one-to-one relationship with table B (has a_id and no name). and table C has many-to-many relationship with table B. How do i attach data from table B to table C by searching using name from table A? I know how to use a_id from table B but its weird to attach using id.
7 Replies
Patrick Boivin
Patrick Boivin15mo ago
Can you share a bit more context? Do you have some code you've been trying that you want to improve?
Zetto
ZettoOP15mo ago
I am using Relation Manager "attach" action, I've been trying to figure out how to search using it's parent attribute ('name' field).
recordTitleAttribute('user_id')
recordTitleAttribute('user_id')
works cause the field exist, is there a way to access it's parent attributes? If it doesn't, is there a way I can change the Select option label so the option can be identified by name instead of id or maybe even custom the search like in multi-select?
Patrick Boivin
Patrick Boivin15mo ago
I'm not sure if you can make the search work, I think it's a bit out of my depth. But I think it should be possible at least to show the correct label in the Select field.
Patrick Boivin
Patrick Boivin15mo ago
With ->getOptionLabelFromRecordUsing()
Saifallak
Saifallak15mo ago
@pboivin nope getOptionLabelFromRecordUsing doesnt effect record select in attach at all
Patrick Boivin
Patrick Boivin15mo ago
Can you share the code you have tried?
Want results from more Discord servers?
Add your server