Button to detail page

Hi all,

Quick one - is it possible to make a button that goes to a detail page?

The only workaround I’ve found is to make a list block, restrict it to one result, and it kind of looks like a button (ish).

Snipaste_2022-10-01_23-18-01

In this case it’s a one<->one relationship between one record in one base and one in another. Is this possible?

Thanks!

Hi there!
Can you precise your question? Do you want to make a button that goes to a details page or to only one item details?
Because you can add a button to go to a details page on almost every dynamic block.

You also can use custom code to catch the recordId of a page to land to a list details page that will show the infos related to that recordId

Concerning relations base to base, that’s not really possible. From table to table yes.

To have the right answer, don’t hesitate to describe precisely your use case, the concrete example you have

Hi Matthieu

I’ll try and be more specific :slight_smile:

I would like a single button like this, to go to a detail page relating to information that has been fetched on the current page shown.

Snipaste_2022-10-06_13-37-05

Does that make sense? :smiley:

1 Like

Oh yeah!

So if I’m correct, this button is from a dynamic block?

Three options:

  1. Just use the option “go to page” of the button. the landing page will show the details of the item related to the item you clicked on. That landing page must have one list details block. The rest can be other dynamic list blocks. You will be able to link them to list details block with the conditional filters (see an example with screenshot 1, where the “projects”, next to “loggedin user”, appears because the list details block I added to the second page is related to my projects table.)

  2. You will use the option “open external url” for this button. On dynamic block, this option is, in fact, dynamic. Which means it can grab a specific url that is in your database.

So, how do you create that url in your database, that will be linked to that button?
With a formula field.

You want to take the recordId of the page currently showing and land on an other page with the same recordId (so all the informations from a page will display in the next page).

In order to do so create a formula field and enter that type of formula (see screenshot 2). In this formula example, you can see a violet value. This is a dynamic value, I looked for it in my Airtable database. You can play with it by creating lookup fields (which always come from a “link to another record” field) between your tables inside your base. That way, you will be able to catch dynamic value from an other table, if needed (never from another base, be careful).

  1. Last but not least, you can use a custom code to use a static block to go to an other page but with the right recordId.
    In order to do so, paste the following code inside your footer custom code, at page level (not at app level). You just need to change #feature-grid3 #cta3 by the right id of the block. If you have multiple blocks, separate them with a , without space.
    That way, when you will click on a static block (that has a button) that you setup to go to page X, it will lead you to that page but with the right recordId
<script>
document.addEventListener("DOMContentLoaded", function () {
  const blockIds = '#feature-grid3,#cta3'; // separate multiple block ids with commas
  const waiter = setInterval(function () {
    const urlParams = new URLSearchParams(window.location.search);
    const recordId = urlParams.get('recordId');
    if (recordId) {
        const selectors = blockIds.split(',').map(i => i + " a");
        selectors.forEach(function (item, index) {
            $(item).each(function() {
                $(this).attr("href", $(this).attr("href") + "?recordId=" + recordId);
            });
        });
    }
    clearInterval(waiter);
  }, 100);
});
</script>

Capture
Capture2

1 Like

Yes you were correct, it was a button from within a dynamic block.

That’s great though, I’ll try them all and see what works best.

Actually, by which I mean number 1 & 2 because I’m currently on the free tier so can’t use scripts!

Thanks so much, I’ll give it a go and let you know how it all worked out. :slight_smile:

3 Likes

Okay so I used option 2! It works perfectly, now I have buttons everywhere! Thank you :smiley:

2 Likes