Redirect after action button appending value was executed

It does work with this code yes, with any update method for the action button.

Change project_url by your field in airtable and list-details1 by the id of the list-details

The url field must be visible in the list details, you can see it below, I display it in the list-details (but it can be hidden by changing the color of the text by the background color)

The way your url is made is the problem => you use r/ and not ?recordId=

You should reach out to the customer support in the Softr studio so they can update the code accordingly.

1 Like

Does the URL I want to redirect to require to have the record ID in it as well maybe?
For me, it’s not working with that same code and the column name adapted

See my post above.

You can try this one to adapt to the way your url is structured.
The value of the url still must be visible in the list-details, as explained above.

<script>
window.addEventListener('block-loaded-list-details1', () => {
    window.addEventListener('update-record-success-list-details1', () => {
        const recordId = getRecordIdFromUrl();
        if (window.records && window.records[recordId] && window.records[recordId].record.fields['Project_Url']) {
            const redirectionURL = window.records[recordId].record.fields['Project_Url'];
            window.location.href = redirectionURL;
        }
    });
});

function getRecordIdFromUrl() {
    const url = window.location.href;
    const startIndex = url.lastIndexOf('/r/') + 3;
    const endIndex = url.length;
    return url.substring(startIndex, endIndex);
}
</script>

If it’s not working, please reach out to the customer support so they can adapt it to your specific use case, I can’t have all the time to fix it

THAT SEEMS TO WORK!!! :rocket::rocket::rocket:

Will test it on the real page now, but it seems to wok just fine.
You’re the best @matthieu_chateau !!!

Now I just can’t have a “Save” Button any more because ALL update actions trigger a redirect, both saving the job and applying to it.

1 Like

Hourraaahh!

Yes you will need to add another list-details for other buttons.

1 Like

Hey @matthieu_chateau :wave:

Since there is a new details page block, this solution won’t work for it anymore; do you know if it’s an easy fix to just adjust the code to the news details block that is currently in beta? :slight_smile:

Thanks so much in advance!!