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

OnClick Javascript button to create new Opportunity
Is it possible to use a custom button to create a new record? I'd like to put the button on a custom object (Task Order__c) and have it create a new Opportunity, pulling information from the Task Order into the Opportunity fields. I would also like to be able to specify the record type of the new Opportunity. I have cobbled this together based on some examples I found of other buttons. Am I on the right track? Thanks in advance.
Here is what I am trying:
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} var newopportunity= new sforce.SObject("Opportunity"); newopportunity.Name = "my new opportunity"; newopportunity.Account="{!Task_Order__c.Account__c}"; newopportunity.StageName="Active"; newopportunity.CloseDate=new Date(); newopportunity.Student_Name__c="TBD"; var result = sforce.connection.create([newopportunity]); window.location.reload();
OK, got it working now, in case anyone needs a reference: