locked
Duplicate Detection affecting Audit Plug-In - Any Suggestions? RRS feed

  • Question

  • I've created a Audit Trail on Updates using Pre & Post Plug-Ins.

    The Pre Plug-In gets a copy of the target entity from the platform and stores it in a shared variable. The Post Plug-In compares the Input Property Bag against the image stored in Shared Variables to identify only the attributes that have changed.

    I do this because I don't name the primary entity in my plug-in, so it works on all tables, and as such images and unavailable.

    All this works really well until the "Duplicate Detection" Wizard kicked in and upset everything.

    Normally the following messages are generated: Pre-Update followed by Post-Update,
    but when the Duplicate Detection Wizard fires you get: Pre-Update, Pre-Update and Post-Update.

    Q. is it possible to preserve data in shared variables between the pre-update and the duplicate detection pre-update?

    That would be helpful, but my biggest problem with the "Duplicate Detection Wizard" is that it writes back every single attribute whether it was specified or not. On a normal update of a contact name only the Guid and the contact name is written back to the platform. However, when the Duplicate Detection Wizard kicks in it writes back lots of attributes making each one that doesn't have a value an empty string.

    Q. is there a way to preserve the original update message? I find it strange it does this given that you cannot edit the record at this time, only allowing you to agree to the save or cancel.

    Because I end up comparing an empty string to a null my audit assume the two attributes are different and tries to record the change resulting in an error when it tries to write a null to the platform. (this I can solve by checking blanks and nulls as the same value).

    The other issue I have is that the Lookup attribute value names are lost because of the Duplicate Detection Process.

    for example the Currency name on the original image was stored as 'Dollars' but the current image only holds this as a guid the name property has a null value. This is because its been wiped out by the Duplicate Detection wizard. I now have two different values when comparing, resulting in an audit record being produced when it wasn't necessary, and that audit shows 'before = Dollars' and 'after = Guid'.

    I then had the idea of looking up the missing name property, but I only have the Guid, I don't know which entity it refers to. So I don't know where to go to get the Lookup value translated.

    Sorry about the long post, but does anybody have any experience of working around the Duplicate Detection Wizard with Plug-Ins?

    Regards

    Steve

     

     

    Monday, June 29, 2009 3:58 PM

All replies

  • Hi Steve,

    This might be performance intensive, but you might want to see Lookup Type[lookup.type] and then query system using that particular guid. That should solve it.
    Regards,
    Chinmay
    http://metrix.blogspot.com
    Wednesday, July 15, 2009 6:19 PM