Scenario Overview

In this scenario you have a custom entity called Training Course which has a N:N relationship with the Contact entity. You need to implement a business rule (rollup) that will keep track of the count of Contacts that are associated to a training course. In effect count (rollup) the number of Attendees on to the Training entity.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • We create a formula that can hook into the Associate & Disassociate events within Dynamics CRM. So it executes whenever a many to many relationship gets created or removed.
  • As the association events are generic we need to check for the schema name of the N:N relationship between the 2 entities
  • If the schema name matches then we update the field 'new_totalattendees' on the training course entity
  • This is calculated by finding the total number of contacts associated with training course

N52 Formula Manager Steps

The following set of steps assumes you have an entity called Training Course already created with a N:N relationship between it & the contact entity

  • Create a new formula of type 'N:N Associate'
  • Set the Source Entity to 'Training Course'
  • Copy & paste the formula below into the formula description field & click save
  • You are ready to test


if(GetAssociationRelationshipName() = 'new_trainingcourse_contact', 

​Wizard - FindCount()

 Please see below the wizard you can use to create the FindCount() function call used in this formula. Each of these are searchable via the search icon.

Note 1:  You will need to setup the exact same formula but set the Formula Type to N:N Disassociate if you need to handle contacts being removed from the many to many relationship

Did you know?

North52 has over 500 functions to help you implement advanced business rules and complex decision logic

One of the biggest costs on most Microsoft Dynamics 365/CRM project is custom coding. This is where consultants or developers are invloved in writing 100’s if not thousand’s of lines of code in Javascript and/or C#.

The Formula Manager, part of the North52 Decision Suite is a business rules engine that aims to eliminate this custom coding by using simple formulas instead. It is significantly faster (up to 10 times) than writing custom code and you get the added bonus of lower cost updates if a business rule changes in the future (it is much faster and thus cheaper to change it using a Formula rather than custom code).

There are over 500 functions available in the North52 Decision Suite business rules engine!

Learn more about North52 Business Process Activities