I am working on writing a plugin to provide duplicate detection. However, I need to provide a prompt to allow the user to choose whether to create the record or cancel creation. The duplicate criteria is for a incident/case that has the same customer, contact, and was created in the past 36 hours. Unfortunately, there is not way to create a duplicate detection rule that meets that criteria because the only option for created on is "same day" or "same day and time".
In a pre-validation on create plugin, I use the appropriate logic to detect a duplicate. If I detect a duplicate I throw the following exception that displays the duplicate detected prompt. The problem is the prompt does not show the duplicate record only the original record. Does anyone know how to add the necessary information to the exception so it displays the duplicate records as it should??
This is the code I am using to throw the exception:
FaultException<OrganizationServiceFault> ex = new FaultException<OrganizationServiceFault>(new OrganizationServiceFault() { ErrorCode = -2147220685 }, new FaultReason("A record was not created or updated because a duplicate of the current record already exists."));
ex.Detail.Message = "A record was not created or updated because a duplicate of the current record already exists.";
*This post is locked for comments
I have the same question (0)