Hi

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())
e.moveNext();
}

//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";

NewRecord.SaveChanges();

//Redirects to List of Opportunities
//Response.Redirect(CRM.URL(184));
%>