You need to sign in to do that
Don't have an account?

Error in Opportunity Creation = Type Error:sforce.connection.insert is not a function?
I am in the process of creating a custom javascript that appears on a opportunity list view. However when I test the button, I recieve the following error: Error in Opportunity Creation = Type Error:sforce.connection.insert is not a function?
The code I am using, I found in the forum and I modified. I am not sure how to resolve the error. I am not a developer. I appeciate the help.
The code I am using, I found in the forum and I modified. I am not sure how to resolve the error. I am not a developer. I appeciate the help.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}; var url = parent.location.href; var records = {!GETRECORDIDS($ObjectType.Opportunity)}; var CreateNewRecords = []; try { if (records[0] == null) { alert("Please select at least one record to update."); } else { for (var a=0; a<records.length; a++) { var create_new_opportunity = new sforce.SObject("opportunity"); create_new_opportunity.RecordTypeId = "012a0000001ZUXg"; create_new_opportunity.AccountId = "{!Opportunity.Account}"; create_new_opportunity.Closedate =new Date("{TODAYY()}"); create_new_opportunity.OwnerId = "{!Opportunity.OwnerId}"; create_new_opportunity.StageName= "Info Gathering/Investigation"; create_new_opportunity.Strategy_Type__c= "Full Launch Target"; CreateNewRecords.push(create_new_opportunity); } var result = sforce.connection.insert(CreateNewRecords); if (result[0].success=='false') { alert(result[0].errors.message); } elese { location.reload(true); } } } catch(error) { alert("Error In Opportunity creation = "+error); }
use this below updated code its help t create new Opp using javascript,
Hope this will help you,
Mark Best ANSER if its work for you.
Thanks
karthik
All Answers
change to:
var result = sforce.connection.create(CreateNewRecords);
use this below updated code its help t create new Opp using javascript,
Hope this will help you,
Mark Best ANSER if its work for you.
Thanks
karthik
In connection plug-in, we don't have method with name sforce.connection.insert. Try using sforce.connection.create it should work.
Thanks!
shiva.sfdc.backup@gmail.com