Hi Forum,
I am working on a project where I am merging 2 CRM systems (both 2011 on premise). I am using SSIS to get source system data in form of sql queries and then using SDK to create records in destination system.
I am facing an issue while creating Opportunity records where status is closed (either won or lost).
I have successfully created opportunity and set the status won or lost according to the source system but not able to copy opportunity close form information like Actual Close date, Actual Value etc...though it is populating "Subject" field which I can see in the opportunity "Close Activities" view.
Below is my code. Would someone please check to find any obvious mistake I have made. There is no error and when I debug I can see the values populated in the object attributes list but upon creating nothing is populated except subject. I have trim down code for better visibility and have put some inline comment.
// creating Opportunity try { Guid OppID = service.Create(CreateOpp); SetOpportunityStatusWon(OppID, SourceRecord) // Source Record is a single record from source query in SSIS package } public void SetOpportunityStatusWon(Guid opportunityId, Input0Buffer SourceRecord) { WinOpportunityRequest Wonreq = new WinOpportunityRequest(); Entity opportunityClose = new Entity("opportunityclose"); //Refering opportunity opportunityClose["opportunityid"] = new EntityReference("opportunity", opportunityId)); // Adding Actual Value,Actualclose date and subject if (!SourceRecord.actualclosedate_IsNull) { opportunityClose["actualclosedate"] = SourceRecord.actualclosedate; // not populating } if (!SourceRecord.actualvalue_IsNull) { opportunityClose["actualvalue"] = new Money(SourceRecord.actualvalue); // not populating } if (!SourceRecord.topic_IsNull) { opportunityClose["subject"] = SourceRecord.Topic.ToString()); //This is generating value } // Execute request wit won status Wonreq.OpportunityClose = opportunityClose; OptionSetValue Won = new OptionSetValue(); Won.Value = 3; Wonreq.Status = Won; service.Execute(Wonreq); }
Thanks for reading.
Regards,
H.Desai