You need to sign in to do that
Don't have an account?
Update Opportunity Amount
Hi - I'm trying to write a piece of javascript to execute when a button is clicked to update the Amount field(or fields for multi select) of Opportunities. I'm having trouble (an unrecognized ; ?) with the following bit fo code and would appreciate any help you may send my way.
Also - could someone please point me towards a document that lists all the SF standard objects with their properties and methods?
Thank you in Advance,
Rich
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var records = {!GETRECORDIDS( $ObjectType.Opportunity )};
var newRecords = [];
if (records[0] == null)
{ alert("Please select at least one row!") }
else
{
for (var n=0; n<records.length; n++)
{
var c = new sforce.SObject("Opportunity");
c.Id = records[n];
// I want to replace the Amount with a calculated field from the current record
c.Amount = {!Opportunity.FirstYearValue__c};
newRecords.push(c);
}
result = sforce.connection.update(newRecords);
window.location.reload();
}