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
Ketan Solanki29Ketan Solanki29 

Need To Disable Custom Button on Page Layout While It Is In Proccess State

Hello, I have Created One Custom Button in Opportunity Object this button call the Web Service and sendig information to external resource. But while on click button it running the proccess if any usr click more time it creating duplicate information on Remote machine which is wrong to the User.

 

If anybody have idea to disable this button while web service code is in progress once the proccessing is over i need to enable that button so user can't able to click the button while it is in proceess.

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
Ketan Solanki29Ketan Solanki29

I got the solution by usning the below java script code given in one of the post.

 

http://boards.developerforce.com/t5/General-Development/Disable-a-Custom-Button-on-a-Custom-object-once-it-has-been/td-p/209138

 

this.disabled = true; //Disable the button 
this.className = 'btnDisabled';//Apply disabled button style(Optional) 
window.location='/apex/YourVFPage}';//Call your VF page

All Answers

Ketan Solanki29Ketan Solanki29

I got the solution by usning the below java script code given in one of the post.

 

http://boards.developerforce.com/t5/General-Development/Disable-a-Custom-Button-on-a-Custom-object-once-it-has-been/td-p/209138

 

this.disabled = true; //Disable the button 
this.className = 'btnDisabled';//Apply disabled button style(Optional) 
window.location='/apex/YourVFPage}';//Call your VF page

This was selected as the best answer
vbsvbs
Ketan - Have you thought of what happens if the user clicks the button and then refreshes the page? Its still open to additional clicks by the user.