+ Start a Discussion
BennettTranBennettTran 

Only allow custom button to be pressed once

Hi All,

 

I have created buttons on a case record type to create child cases when pressed with an app called object converter.  I am looking for  way to show that the button has been pressed and only allow each button to be pressed once.  Please let me know if you have a solution for this issue.

 

Thanks,

cl0s3rcl0s3r

Create a checkbox on the object and then add logic to validate if false then modify to true on run.

 

BennettTranBennettTran
I understand the logic - after button is pressed check the box; if box is
checked don't allow button to be pressed. I am just not sure how to write
it. Can you help with this?

--
Bennett Tran
Salesforce Administrator

P 866.221.1870 x306
F 866.225.0057
E bennett@webpt.com
T twitter.com/webpt


*PLEASE NOTE: The materials in this email are CONFIDENTIAL AND PRIVATE, and
may contain protected healthcare information. If you are not the intended
recipient, be advised that any unauthorized use, disclosure, copying,
distribution, or the taking of any action in reliance on the contents of
this information is strictly prohibited. If you have received this email in
error, please immediately notify the sender via telephone or return mail.*
cl0s3rcl0s3r

Paste your custom Controller logic.

 

Sgt_KillerSgt_Killer

Try having a checkbox in the backend and ensure that the checkbox is enabled when the save method is executed the first time and add a logic to check whether it is checked or unchecked.

 

public PageReference Save(){

 

if(checked(backend checkbox field) == false)

{

         Follow your save procedure

         checked = true;

}

else{

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Message,'Button has been clicked once'));

return null;

}

}

 

Ensure you add the checkbox to the query you have in your controller to fetch its value. And add <apex:pageMessages> in ur VF.