Views:

Overview

In this article, we will show how a single Formula can be used to enforce different rules for different forms. 

For the first form, we want to hide two fields. For the second form, we want to hide 3 fields.  

Note: In this example, we have created two custom forms - Form 1 & Form 2 and four custom fields - Field One, Field Two, Field Three and Field Four. Both forms have all four fields on them. 

North52 Decision Suite

The North52 Decision Suite solution works like this:

  • A Formula is set up on the Account entity
    • It fires on the OnLoad event for both Form 1 and Form 2
    • The Formula will hide certain fields depending on which form it is on

Set up Formula 

  • 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 - Multiple Forms
  • Click Save
  • Under the Register tab, expand Source & Target
    • Select onLoad for both Form 1 and Form 2 
      • You can multi-select by holding Ctrl when selecting
  • Click into the Decision table sheet and rename it to Hide Form Fields
  • In column A, right-click and select Insert > Insert Table Calculation
    • In cell A2, enter Find Form Name
    • In cell A4, enter FindValueQuickName('systemform',GetFormId())
  • Select B2
    • Go to the Source tab
    • Expand Hide Form Fields and select Find Form Name
  • In cell B4 enter 'Form 1'
  • In cell B5 enter 'Form 2'
  • Select column D, E and F
    • Right-click and select Insert > Insert Action
  • Select cell C2
    • Go to the Source tab
    • Expand Source
    • Find Field One and select it
  • Select cell D2
    • Go to the Source tab
    • Select Field Two 
  • Select cell E2
    • Go to the Source tab
    • Select Field Three 
  • Select cell F2
    • Go to the Source tab
    • Select Field Four 
  • Select cell C4
    • Go to the Functions tab
    • Search for HideFields and Ctrl-click to add {{{HideFields}}} to the cell
  • Copy and paste {{{HideFields}}} from cell A4 into cell D4, D5, E5 and F5
  • Your Formula should look like the following: 

Testing

To test the scenario, open an Account with Form 1 selected and see Field One and Field Two be hidden:

Change the Form to Form 2 and see that the fields Field Two, Field Three and Field Four are hidden:

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.

Learn more about Decision Tables