Plugins can be used to execute\perform a task in a event of changing a field of a record in an entity in CRM. Update message can be used in plugins when updating a field in an entity but how can we trigger an event when adding or removing a child record exists under a Many to Many relationship?
When Many to Many relationship exists and some task to be performed when adding records\removing records to\from parent\child entities, we can register a plugin which includes the task to be performed, using plugin registration tool to trigger the plugin at the right time.
Scenario: A system contains students and it captures mandatory subjects for each student. Meaning that one student may exist many subjects (Maths, Science etc…) and one Subject can have many Students according the relationship. Lets assume that both Student and Subject entities are custom entities with new prefix in it.
The task is that; whenever we add\remove a Subject from Student we should update a text field in Student.