You need to sign in to do that
Don't have an account?
Rahul H 4
when the User clicks the button “Activate Accounts”, the selected accounts should get the status Active = “Yes”.
The button with the label “Activate Accounts”, when the User clicks the button “Activate Accounts”, the selected accounts should get the status Active = “Yes”.
The user also needs to get feedback about the successful update or any errors. The list should refresh after a successful update
The user also needs to get feedback about the successful update or any errors. The list should refresh after a successful update
Please try this simple code to get the expected results.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
// identify the record
var o = new sforce.SObject("Account");
o.id = "{!Account.Id}";
o.Active__c = 'Yes';
var result = sforce.connection.update([o]);
//refresh the page
//window.location.reload();
if( result[0].success === "true" ) {
window.location.reload();
}
else {
alert( result[0].errors.message );
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
All Answers
You can use wrapper class with checkbox.
user select the number of account by clicking the ckeckbox after that they click the Activate Accounts button
after the clicking the button we can update the status active = 'yes' in backend.
I think it should help you.
Please try this simple code to get the expected results.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
// identify the record
var o = new sforce.SObject("Account");
o.id = "{!Account.Id}";
o.Active__c = 'Yes';
var result = sforce.connection.update([o]);
//refresh the page
//window.location.reload();
if( result[0].success === "true" ) {
window.location.reload();
}
else {
alert( result[0].errors.message );
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
Thanks for the reply
Can we update multiple accounts? For example: If I have a checkbox and I select multiple accounts and then I click on the button "Activate Accounts", what should be the logic?