Can somebody help me with this code I am trying to change the value if the Validated__c field to true whenever the button is clicked.
Class Code:
global class checkbox{
webservice static void check(Id localId) {
Account acc = new Account();
system.debug(localId);
system.debug('localId');
acc.Id = localId ;
acc.Validated__c = true;
update acc;
}
}
Button Code:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
alert("This is it!");
if({!Account.Validated__c}=true)
{
sforce.apex.execute("checkbox","check",{localId:"{!Account.Id}"});
alert("This is it!");
}
Validated__c
to true on click of button, right? Then why are you checkingAccount.Validated__c = true
?? (BTW, condition is also wrong, there should be one extra=
if you want to check)