Create a Opportunity Custom Button and select Behavior as Execute javascript and paste the below code,
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")}
var opp = new sforce.SObject("Opportunity");
opp.Id = "{!Opportunity.Id}";
opp.StageName = "Closed Won";
//update the opp
result = sforce.connection.update([opp]);
if (result[0].getBoolean("success")) {
log("opp.with id " + result[0].id + " updated");
} else {
log("failed to update opp." + result[0]);
}
When user clicks that button it will make that opportunity as Won.
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")}
var opp = new sforce.SObject("Opportunity");
opp.Id = "{!Opportunity.Id}";
opp.StageName = "Closed Won";
//update the opp
result = sforce.connection.update([opp]);
if (result[0].getBoolean("success")) {
log("opp.with id " + result[0].id + " updated");
} else {
log("failed to update opp." + result[0]);
}
When user clicks that button it will make that opportunity as Won.
No comments:
Post a Comment