Views:

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.

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • We create a formula that can hook into the Associate & Disassociate events within Dynamics 365. 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

North52 Decision Suite 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
     

Formula

if(GetAssociationRelationshipName() = 'new_trainingcourse_contact', 
 
                  UpdateRecord('new_trainingcourse',   
                               [new_trainingcourse.new_trainingcourseid],        
                               SetAttribute('new_totalattendees', 
                                            FindCount('new_trainingcourse_contact', 
                                                      'new_trainingcourseid',
                                                       [new_trainingcourse.new_trainingcourseid],
                                                       'new_trainingcourseid','0'))),
'NoOp')

​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?

Decision Tables Enable Responsive Businesses

You can make, test, and deploy changes to decision logic without software development. Rather that waiting weeks or months for internal or external developers to make needed updates and changes, they can be made by business analysts as they are needed.

Decision Tables within the North52 Decision Suite provide a business-friendly representation of the decision logic so that business analysts can define how the decisions are made. As you define your decision, you can test and validate the decision approach and when ready, deploy the decision logic to your production instance.

Learn more about the North52 Decision Tables