Views:

Overview

In this scenario we have business rules which update 3 fields on an entity, however a specific field should only be updated when certain conditions are met. We want to simplify the decision logic and execute a single update, only changing the relevant fields. In essence we want to dynamically build the SetAttributes of an UpdateRecord function depending on conditions.

In this example we will have 3 custom option sets that, when set to true, will cause an update to their corresponding fields.  

We will use one UpdateRecord at the end of the Decision Table to encompass all outcomes .

Note: We have created three custom boolean option sets -  Set Credit Limit, Set No. of Employees Set Annual Revenue and have added them to the Account form

North52 BPA Solution

The North52 BPA solution works like this:

  • A Formula is set up on the Account entity that fires upon change of any of the three custom fields Set Credit Limit , Set No. of Employees Set Annual Revenue 
    • This formula will check each field and change its corresponding field accordingly
      • For example if Set Credit Limit is set to True, the field Credit Limit will be set to 1000
         

Set up Formula

  • Create a new formula, setting the following values in the Formula Guide:
    • Source Entity set to Account
    • Set Formula Type to Save - Perform Action
    • Select the Decision Table editor
    • Select Create
  • Change the Name of the formula to Dynamic Generation of UpdateRecord Attributes
  • Expand Source & Target
    • Under Source Property, multi-select Set Credit Limit, Set No. of Employees and Set Annual Revenue 
      • You can multi-select by holding down the ctrl key when selecting
  • Click Save
  • Click on the Decision Table Editor
    • Right-click and select Insert > Insert Decision Table
    • Right-click and select Insert > Insert Decision Table again
    • Double click the sheet names and rename them Intialization, Set Variables and Update Account respectively

Sheet: Intialization  

  • Delete the Condition and Action columns by selecting column A and B and right click Delete > Delete Column
  • Create 3 Inline Calculation columns by selecting the columns A, B and C and right-click, select Insert > Insert Inline Calculation
  • In cell A2 enter CreditLimit
    • This will be the variable that we eventually will use to update the field Credit Limit
      • Note that it is important to have the variable name be different than the field name
  • In cell A4 enter 'NoOp'
  • In cell B2 enter EmployeeCount
  • In cell B4 enter 'NoOp'
  • In cell C2 enter AnnualRevenue
  • In cell C4 enter 'NoOp'
  • Click Save

Sheet: SetVariables

  • Add 2 Condition columns by selecting column A and B and right clicking Insert > Insert Condition
  • Delete the Action column by selecting column D and right click Delete > Delete Column 
  • Create 3 Inline Calculation columns by selecting the columns D, E and F and right-click, select Insert > Insert Inline Calculation
  • Select cell A2
    • Go to the Source tab
      • Expand Source and find and select Set Credit Limit
        • Note: this is a custom field, it will not appear if you have not already created it
  • Select cell A4
    • Go back to Source and expand Set Credit Limit
      • Select Yes
  • Select B2
    • Go to the Source tab
    • Find and select Set No. of Employees 
      • Note: this is a custom field, it will not appear if you have not already created it
  • Select cell B5
    • Go back to Source and expand Set No. of Employees 
      • Select Yes
  • Select C2
    • Go to the Source tab
      • Find and select Set Annual Revenue 
        • Note: this is a custom field, it will not appear if you have not already created it
  • Select cell C6
    • Go back to Source and expand Set Annual Revenue 
      • Select Yes
  • In cell D2 enter CreditLimit
  • In cell D4 enter 1000
  • In cell E2 enter EmployeeCount
  • In cell E5 enter 2000
  • In cell F2 enter AnnualRevenue
  • In cell F6 enter 3000
  • Click Save

Sheet: Update Account

  • Delete the Condition column by selecting column A, right clicking and selecting Delete > Delete Column
  • Add two Action columns by selecting column A and B, right clicking and selecting Insert > Insert Action
  • Select cell A2
    • Go to the Source tab, expand Source (if needed) and find and select Credit Limit
  • Select cell B2
    • Go to the Source tab and find and select No. of Employees
  • Select cell C2
    • Go to the Source tab and find and select Annual Revenue
  • Select A4
    • Go the Source tab 
      • Select the refresh icon in the top right corner of the tab
      • Collapse Source and expand Decision Table Calculations > Set Variables 
        • Select CreditLimit
  • Select B4
    • Go back to the Source tab and from Decision Table Calculations > Set Variables select EmployeeCount
  • Select C4
    • Go back to the Source tab and from Decision Table Calculations > Set Variables select AnnualRevenue
  • Click Save

Testing

To test this, add the all relevant fields to an Account form

When we make a change to one of the custom fields - lets say Set Credit Limit -  we can see that the Credit Limit is changed.

And we can see in the Audit history that the other fields were not updated:

When we change two of the custom fields - lets say Set Credit Limit and Set Annual Revenue  - we can see that both their corresponding fields change

And in the Audit history we can see that the No. of Employees was not updated. 

Did you know?

Over 300 customers use North52!

Join over 300 organizations worldwide who trust North52 to drive their digital transformation into the future:

Serious Power without Code:  Easily build business rules, tests and data packages using our point-and-click editors. Even the most complex business rules are easily configured.

Build Fast:  We’ve built the North52 tools with our user’s productivity in mind – up to 10x faster than writing custom code.

Awesome Support:  We take pride in providing world class support to our customers and partners, ensuring you are successful with North52.

Future Proof:  We ensure your business rules and tests that you configure today, will continue to work with the ever changing Dynamics 365 platform.

Learn more about the North52 Decision Suite