Permissions on a button

Hi Airtable Community,

With sample scripts that I found here, I was able to create a script to duplicate a record, and I’ve set up the script to run on a button. [So, thank you for all those how-to scripting posts!!]

However, I was hoping to be able to limit access to the button, so that only the right people could click and run the script. But, on the button field the option to set “Edit field permissions” is grayed out. I know I can hide the button from certain views, but my users do know how to copy a locked view and hide/show whatever fields they want in their personal or collaborative view.

Is there another way to prohibit who can click a button, since field-level permissions are not an option?

Thanks for any help provided.

Hi @Sharon_Visser, there is no way currently to prevent a button from getting clicked. So if you have a button in your table, users are able to click it.

The solution for this would be to not use a button, but a checkbox which triggers an automation with the script. It’s possible to set field permissions on a checkbox.

I can help you change the script accordingly if you post it here (shouldn’t be too much of a big deal).

Cheers,
Rupert

@Sharon_Visser:

@Rupert_Hoffschmidt’s suggestion is the easiest & best solution to implement, and it is the one that I would recommend for you as well.

Otherwise, there is only one way to prevent a button from getting clicked in Airtable, and it is to make it a button that opens a URL.

You would create a URL formula that results in nothing under the circumstances that you don’t want the button to be clicked. This will dim the button and make it unclickable.

Under the circumstances that you DO want the button clicked, you would need to have your formula result in a URL that triggers a webhook with a webhook automation service like Make.com.

Once your Make.com webhook is triggered, you could just have Make perform the entire automation for you there (i.e. your duplication). Everything could be taken care of for you there, with no scripting necessary at all. So just send the request to Make, and process the entire automation there.

Alternatively, you could have Make send back a POST request to an incoming Airtable webhook using the HTTP tool, which would then run your script within Airtable.

Airtable’s incoming webhooks don’t support GET requests (i.e. URLs), which is why you would be required to use an external tool like Make. There is no way around this requirement at this point in time.

Actually I thought about it again with inspiration from @ScottWorld 's reply… there is a way of making it happen with a button and the consequentially triggered script: You could change the script in a way that it only does what it does (duplicate records) IF it is triggered by a certain user. The current user you get via Session: Airtable Scripting — Session.

Ah, the workarounds we have to come up with to fight Airtable’s limitations — haha! Let me know if you want help with that!

2 Likes

Thank you @Rupert_Hoffschmidt for the idea! The checkbox actually solves 2 problems: 1) field permissions, and 2) a checkbox can be used on an Interface, while a button cannot. I try to use Interfaces as much as possible for my users.

I would also like to learn how to use the current user variable - I think I get it from the link you posted.

1 Like

Thanks, @ScottWorld for this suggestion. It has a lot more moving parts, and I’m trying to do everything within Airtable and not have to purchase other products, at least until I run into a problem that can’t be solved any other way. This certainly adds to my learning!

Always happy to help when you’ve got questions!

Something to keep in mind is that the script runs in the context of the permissions of the active user. If the user does not have the permissions to edit a field or create a record, the script will not be able to do those things. The script will only change data that the user could change manually without the script.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.