function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rstanbaurstanbau 

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();

}

 


 

Message Edited by rstanbau on 06-04-2009 10:22 AM
Message Edited by rstanbau on 06-04-2009 07:48 PM
Message Edited by rstanbau on 06-04-2009 07:50 PM