You need to sign in to do that
Don't have an account?
Rule that Updates Opportunity Stage based on Custom Button being clicked
Hey all.
I have a custom butten that resides on my opportunity (renamed 'School Contract').
I want it so that once the custom button is clicked, the 'School Contract' Stage field is updated to 'Contract Completed'.
How can I do this?
Keep in mind I'm not a very strong coder!!
Thanks a ton!
-Jake
Hi,
You can execute a javascript on click of the custom button.
After you create the custom button execute the javascript like this(change according to your object and fields)
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var opp=new sforce.SObject("Opportunity");
var newRecords = [];
opp.id="{!Opportunity.Id}";
opp.StageName = 'Contract Completed';
newRecords.push(opp);
var result = sforce.connection.update(newRecords);
window.location.reload();
Let me know if its working !!
So would this bit of code go on the actual button itself?
Yes. The code goes with the custom button.
For example:
When you create the custom button select
Display Type as "Detail Page Button"
Behaviour as "Execute JavaScript"
Content Source as "OnClick JavaScript"
You can then place this code.