Clone Opportunity - CRM 2017 - 500 Error

This question is not answered


Has anyone found a way of cloning 'opportunites' or 'leads' in CRM 2017?

We have tried following the various articles on here about the COM ASP API, by Jeff Richards, but these are nearly 5 years old and refer to CRM 7.x.

Here are the articles we have tried:

Here is the code we are trying, adjusted for our own opportunities stages, status' and workflow state:

<!-- #include file ="sagecrm.js"-->
var intRecordId = CRM.GetContextInfo("opportunity","oppo_opportunityid");
var FirstRecord = CRM.FindRecord("opportunity","oppo_opportunityid="+intRecordId);
var NewRecord = CRM.CreateRecord("opportunity");
//copy the data from the first record to the second
e = new Enumerator(FirstRecord);
while (e.item())
NewRecord(e.item()) = FirstRecord(e.item())

//set the fields and properties unique to the new record
NewRecord.oppo_description = NewRecord.lead_description +"- cloned";
NewRecord.oppo_stage = "Renewal";
NewRecord.oppo_status = "In Progress";
NewRecord.SetWorkflowInfo("Opportunity Workflow", "Qualified";


//Redirects to List of Opportunities

All Replies
  • hello chris

    what is the error you are facing with this code? can you share the error on screen ? are you having this code within an .asp page which is called from a button on the opportunity summary screen ?


    Kannan Srinivasan

  • This works perfectly for me in a 2018 R2 instance,


    Kannan Srinivasan