If each affiliate has their own login, perhaps you could just create the formula using a custom extension that retrieves the username from the session, and displays the link for each record clicked on in the grid:
import {useSession} from '@airtable/blocks/ui';
function getLink(productId) {
const session = useSession()
const affiliateId = getAffiliateIdFromUserId(session.currentUser.email)
const link = "https://pickleballist.com/cart/?ref=" + affiliateId + "&add-to-cart=" + productId + "&quantity=1"
return <a href={link}>Link</a>
}
The code needs finishing but just illustrates the point. You could expand this a bit more to get it to print out a list from some or all of the records in a table/view rather than just the selected record.
If each affiliate has their own login, perhaps you could just create the formula using a custom extension that retrieves the username from the session, and displays the link for each record clicked on in the grid:
import {useSession} from '@airtable/blocks/ui';
function getLink(productId) {
const session = useSession()
const affiliateId = getAffiliateIdFromUserId(session.currentUser.email)
const link = "https://pickleballist.com/cart/?ref=" + affiliateId + "&add-to-cart=" + productId + "&quantity=1"
return <a href={link}>Link</a>
}
The code needs finishing but just illustrates the point. You could expand this a bit more to get it to print out a list from some or all of the records in a table/view rather than just the selected record.
This seems like a great solution but not something I know how to implement, out of the box.
We do not want to pay for user accounts for each of our affiliates, and we don't want them to see any of the rest of the bases, so I created a direct/live/dynamic link to the main table, where I was letting my affiliates go. Here's a public link, for reference: https://airtable.com/shrRJAk7TcpJjgDxT/tblBFA9wOyJc5r9UN
@Steve_Haysom I can give you access to the base if that might help you help us with this solution. just shoot me a DM with your email, if that's possible here.
I think the ideal scenario would be that each affiliate signs up for a free airtable account and gets the app. I give them access to a base like that (either grid view or gallery) and they can use the search 🔍 button to find a particular product... then they see the affiliate URL, and it has their ID baked into it, so they can copy and forward/text it to one of their referrals.
I also have the Affiliate partner database that connects to the main base. If we could use your extension to compare the email of the logged in user and query the "Partners" table for the same email, and grab the user ID, to inject into any of the product URLs on the main Inventory page, that would be ideal!
