Scenario:
I have three tables:
- Accounts
- Contacts
- Account Contacts
The Account Contacts table is a junction table enabling many-to-many relationships between Accounts and Contacts.
On the Account page I have a table block linked to the Account Contacts. This enables someone to see what contacts are associated with the account. It also has an action button to add new contacts - which creates a record in the Account Contacts table.
Problem:
I want to have an item action button that opens the Contact detail page (not the account contacts page). The problem is the action button is on the Account Contacts table. I’ve tried using the Open URL option with a custom url including the Contact ID, but it’s not working. Perhaps I’m formatting the URL wrong. I’d like to use a relative URL is possible.
Does anyone know how to accomplish the above?
Thanks in advance.
Hi Toby
Not sure if I’ve understood this right but you could maybe add a record ID field to the Contacts table and then add that as a lookup field in the Account Contacts table which would be linked via the related record and then create a formula field in Account contacts that prefixes the record id with the contact page details url (not sure it makes sense how I’ve written that but not near my laptop just now to screen capture what I mean)
You could then try to use that formula field as the URL
I use a similar type of workaround for putting links to specific records in my email automations but not sure if it would work for your use case if I’ve misunderstood the requirement.
I think we need to utilise the record id field type for the urls for item page details but could be wrong
Hi @TobyMacLeod
Thanks for sharing the scenario and the details. I took a closer look, and I think the junction table may not actually be necessary in your case. Softr’s relation fields already support many-to-many relationships, so you could simplify your setup like this:
-
In your Accounts table, add a relation field linking to Contacts (allowing multiple selections).
-
In your Contacts table, add a relation field linking to Accounts.
- Softr keeps these relations in sync automatically.
Then, on your Account page:
-
Use an Item Details block at the top for the account info.
-
Add a Table or List block at the bottom linked to the related Contacts.
-
To connect the Item Details block with the Table block, add a conditional filter to the Table block. Set it to show records where the Account (the related record field in Contacts) is any of / includes / contains the Current Record’s Account Name (or the primary field from the Accounts table). This ensures only the contacts related to the current account are displayed.
-
Each row can then have an action button to open the Contact detail page directly.
The same can be done on the Contacts page to view related Accounts.
There are some benefits for this approach:
-
No extra junction table to manage.
-
Action buttons work naturally and can open detail pages directly.
-
The setup is simpler, easier to maintain, and dynamic across pages.
The junction table is mainly needed if you want to store additional data about the relationship itself (like a role, date linked, or custom metadata). If that’s not required, this simplified structure should fully meet your needs.
Thanks @sarah_h and @david_mheryan! To clarify, I need to be able to track a contacts role and additional information for each account they are related to, so I need the junction table - although it would be easier to use a direct relationship between the accounts and contacts.
I added a formula field to the Account Contacts table to store a url to the Account detail page and to the Contact detail page. I then populate the Page URL with that field and it works. I believe the URL structure I was using before was causing the issues.
For anyone else trying to figure this out here is the proper formatting for the formula field:
“/page-name?recordId=“&{record ID}
Thanks again for your insight and help.
2 Likes
Glad that you could make this work Toby!