Scenario Overview

In this scenario the business requirement is to format the main telephone number on the Account entity. The requirement is that if the phone number is 7 or 10 characters long we need to apply the formatting rules else leave the phone number as is.

7 Digit Rule
1234567 -> 123-4567

10 Digit Rule
1234567890 -> (123) 456-7890

North52 Decision Suite Solution

The North52 Decision Suite solution works like this,

  • We create a formula to execute on the 'Create & Update' event of the Account entity
  • We set it only to execute when the Main Phone number gets set initially or updated 
  • It first cleans the telephone number by removing all non digits
  • it then checks to see how many digits are in the phone number
  • Depending on the number of digits it applies a Regex which in effect is the formatting rule or it leaves it as is
  • It places the result back into the Main Phone field

North52 Decision Suite Steps

The following set of steps will set this formula up for you,

  • Create a new formula of type 'Save To Current Record'
  • Set the Source Entity to 'Account'
  • Set the Source Property field to 'Main Phone'
  • Set the Target Property field to 'Main Phone
  • Copy & paste the formula from below
  • Click save & test on an Account record



   SetVar('CleanedPhoneNumber', RegexReplace([account.telephone1], «\D», '')), 
          Case( CountCharacters(GetVar('CleanedPhoneNumber')),

              When(7), Then (RegexReplace(GetVar('CleanedPhoneNumber'), «(\d{3})(\d{4})», «$1-$2»)),

              When(10), Then (RegexReplace(GetVar('CleanedPhoneNumber'), 
                                         «(\d{3})(\d{3})(\d{4})», «($1) $2-$3»)),



Did you know?

North52 helps Government (federal and state) departments with complex rules in their Dynamics 365 systems

Public sector organizations frequently deal with large user bases and complex rules and routings. The North52 Decision Suite helps government orgnizations with Dynamics 365 manage processes like:

  • Case Management - task checklists, routing, prioritization and approval
  • Eligibility checks for applications/enrollment
  • Licensing administration

Learn more about the North52 Decision Suite