following in the code to Merge 2 records through Asp.Net
// Connect to CRM 2011
IOrganizationService crmservice;
CrmConnection conn = new CrmConnection();
crmservice = conn.Connect2CRM();
// below are 2 sample account records
//D9E2197D-244C-E211-9675-005056B0000B // Test Account - Vilas M
//BA59DFF0-E939-E211-946D-005056B0000B // Test Company - Vilas
MergeRequest mreq = new MergeRequest();
Guid targetAccountID = new Guid("D9E2197D-244C-E211-9675-005056B0000B");
Guid tobemergedAccountID = new Guid("BA59DFF0-E939-E211-946D-005056B0000B");
mreq.Target = new EntityReference("account", targetAccountID); // Target Account ID , where other account will be mergered
mreq.SubordinateId = tobemergedAccountID;
Entity entAccnt = new Entity("account");
entAccnt.Attributes["Address1_Line1"] = "Test";
mreq.UpdateContent = entAccnt;
MergeResponse mresp = (MergeResponse)crmservice.Execute(mreq);
Console.WriteLine("Sucessfully Merged !! ");
// Connect to CRM 2011
IOrganizationService crmservice;
CrmConnection conn = new CrmConnection();
crmservice = conn.Connect2CRM();
// below are 2 sample account records
//D9E2197D-244C-E211-9675-005056B0000B // Test Account - Vilas M
//BA59DFF0-E939-E211-946D-005056B0000B // Test Company - Vilas
MergeRequest mreq = new MergeRequest();
Guid targetAccountID = new Guid("D9E2197D-244C-E211-9675-005056B0000B");
Guid tobemergedAccountID = new Guid("BA59DFF0-E939-E211-946D-005056B0000B");
mreq.Target = new EntityReference("account", targetAccountID); // Target Account ID , where other account will be mergered
mreq.SubordinateId = tobemergedAccountID;
Entity entAccnt = new Entity("account");
entAccnt.Attributes["Address1_Line1"] = "Test";
mreq.UpdateContent = entAccnt;
MergeResponse mresp = (MergeResponse)crmservice.Execute(mreq);
Console.WriteLine("Sucessfully Merged !! ");
No comments:
Post a Comment