Question Status

Mike Adler asked a question on 24 Mar 2015 1:05 PM

I am trying to update the account associated to a new Opportunity I am creating. I wrote a plugin to retrieve the account, update a field and then update the record. Problem is I get this error:

A record was not created or updated because a duplicate of the current record already exists.

It's being caused by the fact that I have a duplicate detection rule that sees another account that may be  duplicate of the one I'm trying to update. So I found this parameter I could set on the UpdateRequest object to make it ignore duplicate detection called SuppressDuplicateDetection. Problem is even if I set it to true I still get the error. Here is the code I am using.

                            UpdateRequest reqUpdate = new UpdateRequest();
                            reqUpdate.Target = accountEntity;
                            if (reqUpdate.Parameters.Contains("SuppressDuplicateDetection")) 
                                reqUpdate.Parameters["SuppressDuplicateDetection"] = true;
                                reqUpdate.Parameters.Add("SuppressDuplicateDetection", true);
                            UpdateResponse updateReponse = (UpdateResponse)service.Execute(reqUpdate);

Based on my testing I can only assume that this parameter does not work. Has anyone else used this with any success?

Mike Adler responded on 2 Apr 2015 10:15 AM

No. That article just talks about what I am already trying to do. I have an open ticket with MS Support now. Through further testing I have determined that the code works if you are just creating an Opportunity directly. The code will fail when you try to qualify a Lead and the qualification process tries to create the Opportunity. MS Support is currently trying to replicate the issue to troubleshoot it. I will post back if I find a resolution.