I’m working on a contractor directory for my building. It’s basically a list of contractors and a contractor detail page for each.
I’m trying to create a sticky button that is shown on every contractor’s detail page. When clicked, the button should open an external URL (specific to that contractor) in a new tab. I created a field in my Airtable database with a formula that creates the WhatsApp message link (this is how it works, if you’re not familiar).
If the WhatsApp URL is stored in your main users’ table then you might try this code:
<script>
window.addEventListener('block-loaded-yourBlockName', () => {
if (window['logged_in_user'] && window['logged_in_user']['softr_user_email']) {
let customButtonWhatsappUrl = window['logged_in_user']['your airtable field name with whatsapp link'];
// You can use 'customButtonWhatsappUrl' within this block
}
});
</script>
Sadly, the WhatsApp URLs are not stored in the main users’ table.
In this case, users are the neighbors in my building and the WhatsApp URLs belong to contractors, who don’t use the platform, and whose information is located in a table called “contractors”.
The button is shown on the detail page for a every contractor.
Hi @acjnas, I used the Artur’s approach in the thread you shared. Thank you so much. I’m gonna share the code with the community just in case anyone else can find it useful