You need to sign in to do that
Don't have an account?
TimS
How to run workflow from custom button
I need some help with javascript code for custom button to update a field on a record so a workflow rule is executed that then sends an email alert. I have a checkbox field to update but as I am not versed very well in code to update it, need some assistance. Does anyone have some code to accomplish this yoy can share? Thanks.
{!requireScript("/soap/ajax/32.0/connection.js")}
var update_Account = new sforce.SObject("Account");
update_Account.Id = "{!Account.Id}";
update_Account.At_Risk_Request__c = true;
sforce.connection.update([update_Account]);
window.location.reload();
All Answers
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008mxjIAA
Its a similar questions with sample code.
{!REQUIRESCRIPT('/soap/ajax/31.0/connection.js')}
var atRisk ="{!Account.At_Risk_Request__c}";
var account = new sforce.SObject("Account");
account.id = "{!Account.Id}";
account.atRisk = 1;
var result = sforce.connection.update([Account]);
if(result[0].success == 'true'){
location.reload();
alert('Your request for access to this account's At Risk details has been Sent Successfully. You will be notified of the decision to grant or deny access');
}
else{
alert('An Error has Occurred. Error:' + result[0].errors.message);
}
{!requireScript("/soap/ajax/32.0/connection.js")}
var update_Account = new sforce.SObject("Account");
update_Account.Id = "{!Account.Id}";
update_Account.At_Risk_Request__c = true;
sforce.connection.update([update_Account]);
window.location.reload();