Scenario Overview
In this scenario we will demonstrate how to set up a Decision Table that will segment Contacts into various Age Groups using their Birthday. We also show how we will populate the Next Birthday field so that the segmentation process can run each year.
This scenario will demonstrate how to use a Calculation as an Action.
For this article it is assumed that you have at least basic familiarity with Decision Tables and/or have read the following articles:
Note: We will not detail step-by-step instructions here on how to set up Conditions or Actions, please read the above articles if you need detailed configuration steps.
The Contacts will be grouped according to the below segments,
Age in Years | Age Group |
<1 | Baby |
1 to 3 | Toddler |
4 to 12 | Child |
13 to 19 | Teenager |
20 to 39 | Young Adult |
40 to 59 | Middle Aged |
60 to 99 | Senior Citizen |
>=100 | Centenarian |
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- A formula of type 'Save - Perform Action' is created on the Contact entity
- The Source Property is set to 'Birthday'
- The Event is set to 'Create & Update'
- The Decision Table will calculate the age in years of the Contact
- It will then use that Age to update an OptionSet value
- Finally it will use another Calculation to set the Next Birthday field on the Contact record
Calculations Table
The Calculations table has 2 separate calculations:
- CalcAge - used to calculate the Age of the Contact
- CalcNextBirthday - used to calculate the Contact's Next birthday
Calculations
CalcAge
DateDiff([contact.birthdate], UtcDate(), 'y')
CalcNextBirthday
if ( AddYears([contact.birthdate], DateDiff([contact.birthdate], UtcDate(), 'y') ) > UtcDate(),
AddYears([contact.birthdate], DateDiff([contact.birthdate], UtcDate(), 'y') ),
AddYears([contact.birthdate], DateDiff([contact.birthdate], UtcDate(), 'y') +1 )
)
Set up the Decision Table
Now that we have configured our Calculations we need to build the decision table.
Since we are interested only in the Age of the Contact it is the only Condition.
The Actions are set to the Age Group field and the Next Birthday field.
We populate each Decision Table row with the {CalcNextBirthday} Action as want to update the Next Birthday field as well as setting the Age Group OptionSet.