If you have Dynamics 365 for Sales or Service there are often business rules that need data from Dynamics 365 Finance and Operations. With the virtual entities support provided by Microsoft it is very easy to use Finance and Operations data in your North52 business rules. Using a simple scenario of displaying a notification to the Dynamics 365 Sales User, we show how easy it is to build a North52 business rule based on Invoice information that is stored in Dynamics Finance and Operations. Although complex scenarios are supported using the North52 business rules engine, this article is intended to show the basic mechanics of using Dynamics Finance and Operations data with North52.
Rules for Finance and Operations Invoice Notifications
Display a form notification to the user when there are outstanding invoices in Dynamics Finance and Operations.
If the value is over 50,000 the message should show the amount and be formatted like an ERROR notification.
If the value is over 10,000 the message should show the amount and be formatted like a WARNING notification.
If the value is less than 10,000 the message should show the amount and be formatted like an INFO notification.
North52 Decision Suite Solution
The North52 Decision Suite solution works like this:
- A Formula is set up on the Onload event of an Account Form which:
- Queries Finance and Operations data via virtual entities
- Finds open Invoices for the Account which has been loaded using the Account Number
- Sums the Invoice Amount and displays a notification based on the Total Value of Invoices
Set up Formula
- Open the North52 App
- Navigate to Business Process Activities > Formulas
- Create a new formula, setting the following values in the Formula Guide:
- Source Entity set to Account
- Set Formula Type to ClientSide - Perform Action
- Select the Decision Table editor
- Change the Name of the formula to Account - ClientSide - F&O Outstanding Invoices Messages
- In the Source and Target section, select Onload for the Account form
- Click Save
- Select cell A2
- Select the Functions tab, type findsum into the Search Functions input box and press enter
- Shift-click on the FindSum function to open the function wizard:
- Type Sum F&O Invoices in the Friendly Name field and leave the Type as Calculation
- Set Entity Name to mserp_salesinvoiceheaderv2entity (select Sales invoice headers V2 from the search options)
- Set Where Attribute to 'mserp_dataareaid','mserp_invoicecustomeraccountnumber' (select Company Code and Invoice Account from the search options)
- Set Equals Value to 'USSI',[account.accountnumber] (USSI is the Finance and Operations company code, [account.accountnumber] can be added from Source Tab > Source > Account Number)
- Set Select Attribute to mserp_totalinvoiceamount (select Invoice Amount form the search options)
- Set the Default Value to 0
- Leave No-Lock as true
- The completed wizard will look like this:
- Click Generate
- Virtual Entities do not support aggregate queries so we need to make a modification to the function that was created on the Global Calculations sheet:
- Press F4 or right-click on the Decision Table sheet and select Operations > Toggle Advanced Mode
- Select the Global Calculations sheet
- Select cell B4
- Expand the cell editor (+ icon in top of Decision Table sheet)
- Add 'true' as another parameter at the end (See FindSum Example 2 definition):
FindSum('mserp_salesinvoiceheaderv2entity', SetFindAnd( 'mserp_dataareaid','mserp_invoicecustomeraccountnumber' ), SetFindAnd( 'USSI', [account.accountnumber] ), 'mserp_totalinvoiceamount', '0', 'true', 'true' )
- Close the cell editor
- Select the DecisionTable sheet
- Select cell A4
- Enter >50000
- Select cell A5
- Enter >10000
- Select cell A6
- Enter >0
- Select B4
- Select the Functions tab, type notification into the Search Functions input box and press enter
- Shift-click on the SetFormNotification function to open the function wizard:
- Leave the Friendly Name field blank (this will insert the function directly into the cell)
- Set Message to 'There are outstanding invoices in Dynamics F&O to the value of ' + ToString(GetVar('Sum F&O Invoices'), '#,000')
- Set Level to Error
- Set UniqueID to msg1
- Click Generate
- Repeat the SetFormNotification wizard for cells B5 and B6, changing the Level to WARNING and INFO respectively
- Click Save
- Select North52 Commands > Publish Formula from the command bar
- The Formula should look like this:
Open an Account record that you know has open invoices in Finance and Operations and you should see a notification displayed:
Did you know?
North52 TestShield ensures Quality at Speed
TestShield's automated tests run on the Dynamics 365 platform rather than in the browser allowing extreme speed.
For example, we can run 1100 tests with over 15,000 Asserts to verify a new release of the North52 Decision Suite, in less than 4 minutes!
It means that we can deliver quality releases at unprecedented speed. Before TestShield, testing a new release was very manual and time consuming.