locked
N-N relationship plugin RRS feed

  • Question

  • Hi,

    There are the system entities systemuser and role with the N-N relationhip between them of systemuserroles.  If I want a plugin to fire on the modification of this N-N collection where do I place plugin?  My guess would be the systemuserroles entity, even though it is not in the customizations list.

    Is this correct?

    Thanks,

    Craig

    Wednesday, April 21, 2010 4:59 AM

Answers

All replies

  • First, you need to know that you can't intercept AssociateEntities and DisassociateEntities event (the ones that are triggered when adding or remving a N:N relationship).

    but, if you really need it, you can enable these events (whereas it is unsupported):

    http://consulting.ascentium.com/blog/crm/Post533.aspx


    My blog : http://mscrmtools.blogspot.com

    All my tools on my new dedicated site: MSCRMTools Repository
    Wednesday, April 21, 2010 7:23 AM
    Moderator
  • Hello,

    The messages you was looking for is called 'AssociateEntities' and is by default 'IsCustomProcessingStepAllowed = false'

    You can find the id for the message in 'SdkMessageBase'. With that id you can set 'IsCustomProcessingStepAllowed' to true.

    Next you have to make the following changes to the Plugin registration tool:

    • add these two lines to the GetMessageNames() method:
      • al.Add(

        "AssociateEntities");

      • al.Add("DisassociateEntities");

    • add these two lines to the GetMessagePropertyNames() method:

      • h.Add(

        "AssociateEntities","MonikerToBusinessEntityMoniker(Moniker1)");

      • h.Add("DisassociateEntities", "MonikerToBusinessEntityMoniker(Moniker1)");

    When you register the plugin you have following restrictions:

    • You cannot select an entity type. you have to select 'None'
    • You cannot select any type of Pre or Post images (if you have already extended your PluginRegistration

    Best Regards, Lassaad
    Wednesday, April 21, 2010 10:22 AM