Help

Re: Track user who clicked a button

2953 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Matt_Muscella
4 - Data Explorer
4 - Data Explorer

I have a button that opens up a URL that acts as a webhook to an external application that runs a function.

In the querystring, I’d like to include either the userID or email of the user who clicked the button for accountability purposes. I don’t see an option for that in the default fields.

Is there any workaround for this? Can I do something to hack that user as the last modifier or something? Is it something that would be possible if I ran a script on button click instead? Script seems like overkill.

4 Replies 4

Welcome to the Airtable community!

Calculated fields, such as buttons and formulas, are not aware of the current user. However both scripting and custom apps can determine the current user.

A script can determine who the current user is. Your button would run a script, and the script would calculate the url, including the current user’s email as a query parameter. Then the script would output the link.

Or you could have the script call the webhook itself, without the user having to click the link.

I do not recommend using a last modified by field type, as the current user may not have actually modified anything before clicking the button.

If you do not code, but have budget to hire someone to write a script, feel free to book a meeting with me.

Another option would be to use either a checkbox or single select field as the trigger to drive an automation, which would run a script to determine the user and trigger the webhook as @kuovonne suggests. The benefit to this method is that the sidebar would stay closed for a slightly cleaner user experience. While it’s an extra click to use a single select field, I prefer that option over checkbox triggers partly because I can have different select options trigger different automations, plus the extra click prevents accidental triggers that can happen with checkboxes.

A script needs to use the session to determine the user, and the session is only available in scripting app, not in automations. Thus, an automation script cannot directly detect the user who triggered it. You would need to have a ‘last modified by’ field for the checkbox or single-select field driving the automation.

nelsonb
4 - Data Explorer
4 - Data Explorer

@kuovonne wrote:

Welcome to the Airtable community!

Calculated fields, such as buttons and formulas, are not aware of the current user. However both scripting and custom apps can determine the current user.

A script can determine who the current user is. Your button would run a script, and the script would calculate the url, including the current user’s email as a query parameter. Then the script would output the link.


Are you refering to the scripting extension specifically? But is there a way to trigger it from an interface where the button will be? I see that buttons in an interface can trigger an Automation but that doesn't have the Session (and hence current user) in scope.

And when you say "custom apps", do you mean just that filters on a User column can filter by "current user"?

I'd also like to have a button in an interface, that changes a "User" type field in a record, by adding the "current user" but not seeing how.