You need to sign in to do that
Don't have an account?
Michael Carrier
Custom Button Java Script Help
We created a button to update pricing on our opportunity, and it works, however if there is existing pricing the button will throw an unexpected number error. Is there somthing I can add to the beginning of the code to clear out the fields before it updates? Any help would be greatly appreciated. Here is the code below:
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")}
var opptyObj = "{!Opportunity.Market_and_Package__c}";
if(opptyObj === "Basic-B"){
var oppToUpdate = new sforce.SObject("Opportunity");
oppToUpdate.id = "{!Opportunity.Id}";
oppToUpdate.pricefield1__c = 29.99;
sforce.connection.update([oppToUpdate]);
window.location.reload();
} else
{
alert("Pricing Not available for Opp");
}
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")}
var opptyObj = "{!Opportunity.Market_and_Package__c}";
if(opptyObj === "Basic-B"){
var oppToUpdate = new sforce.SObject("Opportunity");
oppToUpdate.id = "{!Opportunity.Id}";
oppToUpdate.pricefield1__c = 29.99;
sforce.connection.update([oppToUpdate]);
window.location.reload();
} else
{
alert("Pricing Not available for Opp");
}