In this business scenario the requirement is to change how we contact the customer depending on the category of the Account.
If the customer's Category is set to Preferred Customer, we wish to use the Account Main Phone field.
If the customer's Category is set to Standard, we wish to use the Account Mobile Phone field.
In both cases, we want the field being used to be mandatory for any creates/updates. We also want the field not being used to be hidden.
N52 Formula Manager Solution
The Formula Manager solution works like this:
- A client-side Decision Table is set up to trigger on the creation or update of an Account's Category field
- If the Category field is set to Standard, the Main Phone field is set to be a required field and shown on the form and the Mobile Phone field is hidden and set to be not be required
- If the Category field is set to Preferred Customer, the Mobile Phone field is set to be a required field and shown on the form and the Main Phone field is hidden and set to be not be required
N52 Formula Manager Steps
The following set of steps outline how to create this Formula:
Note: You will need to ensure the Category and Mobile Phone (either create this field or use the Other Phone field instead) fields are displayed on the Account form before creating this formula.
- Create a new formula using the formula guide:
- Set the Source Entity to Account
- Set the Formula Type to Clientside - Perform Action
- Select the Decision Table editor
- Click the Create button
- From the Source & Target section, locate the *** Account Events *** form and set the Source Property to Category
- Click Save
- Click on cell A2 of Decision Table
- Go to the Source tab and search for "category"
- Expand Source
- Click on Category (Value )
- Click on cell A4
- Go back to the Source tab and expand the Category (Value) node
- Click on Preferred Customer
- Click on cell A5
- From the Source tab click Standard
- Click on cell B2
- Go to the Source tab and search for 'phone'
- Click on Main Phone
- Click on cell C2, right-click and select Insert > Insert Action
- Click on Mobile Phone .
- Note you may not have this field- you can instead use Other Phone but make sure to add it to the form
- Click on cell B4
- Click on the Function tab and search for
- Search for "fields"
- Ctrl+Click SetRequiredFields and then Ctrl+Click ShowFields to add both functions to cell B4 (you can expand the column width to see both functions in the cell)
- Click on cell B5
- Ctrl+Click HideFields and then Ctrl+Click on SetNotRequiredFields to add both functions to cell B5
- Copy and paste cell B4 into cell C5
- Copy and paste cell B5 into cell C4
- Click Save
- From the N52 Commands menu select Publish Formula .This creates the necessary bindings for this formula to trigger when the Category fields changes.
- You are now ready to test. Go to an Account record and change the Category field. The other fields should change according to the rules you have specified. Note: The very first time the formula executes, it may take a few seconds for the change to occur on the form. This is normal and the speed should be near instant once the formula has cached.
Did you know?
Decision Tables Simplify Complex Logic
Decsion Tables allow you manage complex business logic without code. Key features include:
- Simple visualization in a compact table format
- Promotes grouping of rules in a single table
- Business logic can be controlled by domain experts
A Decision Table represents multiple related business rules by using conditions, actions and data values in a spreadsheet-style table. The Decision Table uses columns for the conditions and actions of the rules and rows to represent the associated data values.