Views:

Scenario Overview

Using the North52 business rules engine for Microsoft Dynamics 365 we show how to enforce validation rules whenever an Account is being updated or created.

Validation Rules

Rule # Description
1

Whenever the Account is a Preferred Customer or whenever the Credit Limit is greater than 100,000, display a validation message if the Address fields have not been filled in. 

This can be done easily by making a Decision Table that triggers when an Account is created or when an Account's Address fields are changed. 

North52 Decision Suite Solution

The North52 Decision Suite solution works like this:

  • A Formula of type Validation for the Account entity
    • Each time an Account is created, the Formula triggers
    • Also, whenever any of  following address fields are changed the formula triggers: 
      • Category, Credit Limit,Street 1, Street 2, Street 3, State/Province, Zip/Postal Code, City
    • The Formula will check to see if the Account is a Preferred Customer or if the Credit Limit is greater than 100,000
      • If either of those conditions are met, the Decision Table will then check if the Address fields contain data
        • A error message will show and display all Address fields that do not contain data

North52 Decision Suite Steps

  • Create a new Formula, setting the following values in the Formula Guide
    • Source Entity set to Account
    • Set Formula Type to Validation
      • Note that choosing this type will change Deployment Settings > Pipeline Stage to Pre-Validation (Synchronous)
    • Select the Decision Table editor
  • Change the Name of the formula to Account Conditional Address Validation
  • Expand the Source & Target section
    • Control-click to multi-select the following fields: Category, Credit Limit, Address 1: Street 1, Address 1: Street 2, Address 1: Street 3, Address 1: City, Address 1: State/Province,  Address 1: ZIP/Postal Code
  • Click Save
  • Highlight columns B to
  • Right-click and select Insert > Insert Condition
    • This will insert Condition columns for all the selected columns
      • Note if you have a North52 BPA version less than 562 you will need to manually add the columns one by one
  • Select column I, then right-click and select Insert > Insert SetVarConcat Calculation (*-)
  • Replace SetName with ValidationFields
  • Right-click the sheet Hit Policy > Exit this Decision Table on First Match and uncheck the checkbox
  • Select column J, then right-click and select Insert > Insert Inline Calculation (==)
  • Replace SetName with FinalValidationMessage
  • Right click and select Operations > Toggle Advanced Mode
  • In cell I3, paste ContainsData(GetVar('ValidationFields'))
  • Select cell A2
    • Go to the Source tab and and expand Source
    • Find and click Category (Value)
  • Select cell A4 
    • Go back to the Source tab and expand Category (Value)
    • Click on Preferred Customer
  • Select cell B2
    • Go back to the Source tab, find and click Credit Limit
  • In cell B4 and type >100000
  • Select columns A and B
    • Right-click and select Set Condition Column Options > Condition-Or
  • Select cell C2
    • Go to the Source tab and click on Address 1 : Street 1
  • Select cell C4 and then go to the Functions tab
    • Search for doesnot and ctrl+click the DoesNotContainData function
  • Select cell I4 and type 'Required Field: Address1 Street1' including the quotes
  • Repeat this for each address field in columns D, E , F, G and H like the image above
  • In cell I10, paste TRUE
  • Click Save

The Decision table will now check

  • If Category is set to Preferred Customer OR if the Credit Limit is greater than 100000 
  • If any of Address fields are empty

Whenever these conditions are met, the FinalValidationMessage is updated with the relevant message and an error message will be shown to the user.

Did you know?

You can easily add powerful business logic to Power Apps Portals

North52 Business Process Activities provides the ability to easily configure and execute business rules on Power Apps Portals Forms.

We make it very easy for you to configure simple or complex logic that changes the behavior of the form:

  • Show/hide fields
  • Show/hide sections
  • Set fields required/not required
  • Show/hide notifications
  • Set field values
Learn more about North52 BPA for Dynamics Portals