Custom Script for Button

Hi Everyone,
Is there any way that I can restrict a button visibility or its functionality using a custom script.

I am using user_roles but not getting the required result.

Regards
Ruchin Sharma

There are quite a few ways to do this. Can you give an example of specifically what you are trying to do? On what basis are you trying to restrict the button (specific users, based on field entries,etc)?

@Ben_Cornwell_Mott

My requirement is, in item doctype I am using a custom workflow based on that user will submit the item for approval and the approver may approve or reject the item by verifying its properties .

But, once the item is approved then no one can make changes in it, if it is still required to make changes in the approved item, then then item must be reverted back to its initial state.

For that, I am using a custom button, but that will only work if a user have specific role assigned to it.

This is my requirement.

Regards
Ruchin Sharma

In the custom field view for the Button you added, there is a Permissions are which will allow you to control who can see it. Try searching for Field Permissions in the forum.

@Ben_Cornwell_Mott

Thanks a lot for your suggestion, but I am not very much comfortable with this technology.

I will find another way to do it, I hope.

Thanks & Regards
Ruchin Sharma