Hey folks, something I’ve wanted to be able to do within Stacker is see who has clicked a particular action button. Zapier doesn’t send the data of the logged in user who clicks a button as standard, but I got round this in a hacky way which worked for my use case. There’s a few limitations (it’s a hack, after all!):
- It only works for Stacker Tables
- Depending on how your data is structured, it could be heavy on Zaps - this would only make sense for certain use cases
- It requires one more click by users
Overview: Rather than using an action that triggers a Zapier, we use an action to update a hidden field in Stacker that Zapier uses to trigger actions.
I want to create a setup where a person can register for events by clicking a button in Stacker, like below. You can actually try this particular app out to see how it works from a user’s perspective by registering for it here: https://sampleapps.stackerhq.com/eventstutorial/register
Part 1 - Set up Stacker
Within the data grid for this events page, I need to make sure I have
- A text field called “Hidden field”
- A Last modified by field
`I then set up an “Update Record” action to update the hidden field
I don’t want the user to actually edit anything here - I just want to update the hidden field to something (anything!). I set this up using “enable default value” and not allowing the user to edit the value.
This will update the “Last modified by” for the event. Finally, style your Action button to explain what’s happening.
Part 2 - Now, over to Zapier:
In Zapier, I need a three part Zap:
- Zapier will listen for the Events table in Stacker being updated
- It will then use the Last modified by column to find details of that user
- It will invite that user to the event via email
Part 2.1 - Trigger:
We want to use Stacker’s “Record Edited” event in Zapier
Find your App / Table
And when you test your app, if it has worked, you should have this data pulled in about the last modified by user:
Part 2.2 - Find details of that user
We want to use the “Search Record” event in Zapier
Now you want to configure this to look at your User table, and select the search field as “ID”. Finally, the Value to be searched for will be the user’s ID from the first step (“sid”).
If this works, it should pull in all the user data you have about that person, including their email address
Part 2.3 - Do something with that information!
I set this up so Zapier will send a confirmation email to the user to let them know they’re registered for the event. But you could equally send them a calendar invite, a Slack message, add them to an audit log - whatever you need for your workflow.
This is an idea of how you could get started - one other thing I’ve implemented on a different app is a gating system so the Zap only triggers when the Hidden field is updated (right now it could also trigger if you updated the events details, say). But that’s a tutorial for another day