Home > MSCRM General > Event on Many to Many Relationship (N:N) in CRM 4

Event on Many to Many Relationship (N:N) in CRM 4


Microsoft Dynamics CRM 4 does not expose any event when records are associated through N:N relationship. So if you want to perform some function when a record is associated to another record in N:N relationship, CRM simply excuses and you have to look into hacks and unsupported solutions.
Hack 1:
Aaron has come up with a solution to expose the Disassociate and Associate event using a SQL script. This is unsupported customization and Microsoft is not supporting these changes.
Hack 2:
Create a flag at the master entity named IsDirty and place that attribute at a hidden tab.
At onload event simply mark this attribute as true.
crmForm.all.oa_isdirty.DataValue = !crmForm.all.oa_isdirty.DataValue;
Now you can have an attribute that prompts user every time to save the form and you can plan a workflow or plugin that executes on update of this event.
This is a supported customization and can easily be upgragable.

Microsoft Dynamics CRM 4 does not expose any event when records are associated through N:N relationship. So if you want to perform some function when a record is associated to another record in N:N relationship, CRM simply excuses and you have to look into hacks and unsupported solutions.

Hack 1:

There is a cool hack by Aaron at http://consulting.ascentium.com/blog/crm/Post533.aspx.

Aaron has come up with a solution to expose the Disassociate and Associate event using a SQL script. This is unsupported customization and Microsoft is not supporting these changes.

Hack 2:

Create a flag at the master entity named IsDirty and place that attribute at a hidden tab.

IsDirtyFlag

 

  At onload event simply mark this attribute as true.

crmForm.all.new_isdirty.DataValue = !crmForm.all.new_isdirty.DataValue;

Now you can have an attribute that prompts user every time to save the form and you can plan a workflow or plugin that executes on update of this event.

This is a supported customization and can easily upgraded.

Advertisements
  1. December 28, 2009 at 10:06 pm

    One more click I found this, thank you, god knows where I will be after this. Please check this out:

  2. February 16, 2010 at 8:19 am

    Hack 2 not work!

    Because after add new record to N:N relationship, user could close the window (not click save button) and new record has been added already, so you couldn’t catch the event on “Update” entity.

    Ning

  3. Thomas Rehm
    April 28, 2010 at 3:17 pm

    Can’t you fetch the AssociateEntities Request via .NET-Plugin?
    In your code you can start a workflow, so that your users can build the workflow themself…

    Or you could build an config-entity, where your users can define: when connecting record or type1 with record of type2, then start workflow 1…

    dont know if you can fetch this event, but if that works, you can get the whole thing work real nice…

  4. April 29, 2010 at 1:12 am

    You are right. It can be extended to this limit in order to fit in requirements.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: