locked
Detect Duplicate on create of activity and update it.CRM 2011 RU-8 RRS feed

  • Question

  • Hi All,

    I have to detect or identify duplicates on create of activity, via plugin. in our current CRM application whenever any appointment gets created , it is automatically creating multiple duplicates of the same.

    and there are some column based on that we can identify and detect duplicates.

    I thought the approach to write a plugin on create of appointment and get all the columns from target entity.

    and use these columns values in query (Linq or Queryexpression) to retrieve all the duplicates (via early bind or retrievemultiple)

    But there are thousands of appointment gets created so it may be a performance issue.

    I also explored about RetrieveDuplicateRequest but there are only five rules we can publish in CRM 2011

    Can we use direct SQL query in plugin to identify duplicates on the fly (on create).

    Please help

    Regards

    Abdul

    Saturday, February 20, 2016 11:33 AM

All replies

  • Hi,

    It sounds as if something weird is happening if each created appointment creates duplicates. Try to troubleshoot the issue instead of trying to mend the symptoms.

    Do you have any plugins running on appointment?

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Monday, February 22, 2016 8:40 AM
  • Hi Norstrom,

    Thank you for replying.

    No , We don't have any plugin written on appointment.

    It is known issue in our environment, its due to legacy system integration.

    that is different and long story , now we have to avoid it in a way that if the current record is duplicate then flag it and let them create in a CRM.

    later we can do advance find to delete.

    Monday, February 22, 2016 10:15 AM
  • Hi,

    It is indeed a problem. As soon as the create request is sent to CRM, the only way to stop it is to throw an exception in the plugin code, I don't know any way of doing a "graceful quit". The best option i if you can stop the integration from doing the create call. What you're writing about setting a duplicate flag is of course an option aswell, then you will enter the next issue you will face, how to identify the duplicates, which might be easy or very very hard.

    If you want to flag duplicates, go with a pre operation create plugin. I wouldn't write it to call the database but query CRM, that way you have the plugin in the supported box which is good for possible future upgrades.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Monday, February 22, 2016 12:54 PM
  • Hi Norstrom,

    Sorry for the late reply.

    We have to register this plugin as Asynchronous so we can not use pre-operation to flag duplicate without Update service call.

    I have written async post create of appointment plugin but its behaviour is inconsistent sometime it is flagging/Marking duplicate and some time not.

    And during data import it is marking duplicate to all records , it should leave first record as a original.

    Can you suggest an approch with Async mode.

    Do we need to apply fetch/queryExpression paging to find record in all the appointments ?? if Yes then it would be performance issue ?

    Thank you so much. 

    Saturday, July 23, 2016 10:35 AM
  • Hi,

    Unfortunately that's working as inteded. Because you're doing this asynch, when the plugin is running there are multiple records available and it doesn't know which is first that way. I don't know what you're using as duplicate detection rule but you might be able to also check for created-time and if this record according to the rest of the criteria is a duplicate and created first it shouldn't be the deletable record so to speak. With the asynch plugin you're pretty much doing a duplicate deletion job.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Saturday, July 30, 2016 2:27 PM