function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chessbasechessbase 

How to disable a custom button

I have a custom entity and on certain condition I want to disable button to stop the further sync. Is it possible to disable a button once the custom object is synced with my application? If so how can I acheive that?
 
Thanks in advance
sfdcfoxsfdcfox
As the last line of your button's source code, add "this.disabled = true". This will disable the button until the user refreshes the page or otherwise navigates away. Otherwise, use a cookie value and display an error if they're not allowed to sync again yet-- and then disable the button.

~ sfdcfox ~

Message Edited by sfdcfox on 08-15-2007 02:20 PM

chessbasechessbase
I guess u didn't understand my requirement. I want to disable a custom button once the custom object is synced with our database. this.disabled=true will not work here, I think the vaildation will do the trick for me but i'm not getting through with validation.
 
Just to breif u again on my requirement, I create a custom object entry and save it. From here my custom button appears on the edit screen. I click on my sync button and the info is saved (synced) in to my db. And from now on I want the custom button to be disabled forever (so that it wont' synced again by mistake).
 
Thanks
sfdcfoxsfdcfox
If you use Enterprise Edition, have the custom button change the record type (and thus, the page layout) of the record. The button will be unavailable for future use after the record type is changed. Alternatively, you could use a checkbox that is not on the page layout, but available for use via FLS. Then you can check the box after syncing. Finally, your button code would include logic that checks if the box is already checked, and, if so, refuse to sync again.

If you have Professional Edition, there is no way to enforce this behavior, and you have no further options available to you that are "user-proof". In this case, you would need to have the server check to see if it's already been synced, and possibly return an error to the user.

~ sfdcfox ~
chessbasechessbase
I'm using Professional and I implemented the same thing as you said. Checking the UniqueId on server side and showing a message. Thanks anyways. I appreciate your help.