+ Start a Discussion

Getting Newly Created Opportunity Id

Hi All,
I have created a new opportunity. After creating i have tried to retrive the new Opportunity Id by the following way, but is saying that it is undefined.
var saveResult = sforceClient.create([Opportunity]);

for (var i=-;i<saveResult.length;i++) {

    if (saveResult[i].success == true) {

       alert("Yay!! I created a record and the Id of the new record is: " + saveResult[i].Id);

    } else {

       alert("Rats!  There was a problem and I think the problem is: " + saveResult[i].errors[0].message);



the saveResults[i].Id is not giving the newly created opportunity id. Can someone tell me how to get newly created opportunity id.

Any kind of help is appreciated.


Id is case sensitive, your code should be saveResults[i].id, not saveResults[i].Id
Thanks gsickal, it worked...Thanks a lot