Scenario overview
In this scenario, we are going to hide or show, enable or disable various fields on a Power Pages website Case submission form based on what Case Type is selected by the user.
The rules are:
- If the Case Type is Problem
- Show Subject field and make it required
- Enable the Contact field
- Prepend Problem: to the already entered Title
- If the Case Type is Question
- Hide Subject field and make it not required
- Disable the Contact field
It is expected that you have read and understood the basic articles on how to configure a Decision Table. The primary goal of this article is about setting up a formula on the Portal and won't be going in to explicit detail on how to configure a Decision Table. If you need to read these articles first, you can take the free training course BPA - Decision Table Basics: https://support.north52.com/training
Formula
Setup
- Create a new formula, setting the following values in the Formula Guide
- Source Entity set to Case
- Set Formula Type to ClientSide - Perform Action
- Select the Decision Table editor
- Click the Create button
- Set the Name to Case - Portal - Set Fields for Case Type
- Expand the Source & Target section
- Set the Source Property under the Web - Create Case Events form:
- Ctrl-click Onload and Case Type
- Set the Source Property under the Web - Create Case Events form:
- Expand the Deployment Settings section
- Select the applicable website from the Portal Deployment list, in this example Customer Self-Service website is selected (Note: if a website is not available to select, please select N52 Commands > Refresh and reload the form)
- Click Save
Configure the Decision Table
- Set up the Condition
- Select cell A2, go to the Source tab and search for case
- Expand the Source node
- Select Case Type {Value}
- Select cell A4
- Expand the Case Type {Value} node
- Select Problem
- Select cell A5
- Select Question
- Set up the Action columns
- Select both columns C and D
- Right-click and select Insert > Insert Action to add two Action columns
- Select cell B2, go to the Source tab and search for subject
- Expand the Source node
- Select Subject (Value)
- Select cell C2, go to the Source tab and search for contact
- Select Contact (Value)
- Select cell D2, go to the Source tab and search for case
- Select Case Title
- Set up the Action rows
- Select cell B4, go the Functions tab and search for fields
- Ctrl-click the ShowFields function
- While cell B4 is still selected ctrl-click the SetRequiredFields function
- Select cell B5
- Ctrl-click the HideFields function
- While cell B5 is still selected ctrl-click the SetNotRequiredFields function
- Select cell C4
- Ctrl-click the EnableFields function
- Select cell C5
- Ctrl-click the DisableFields function
- Select cell D4, type 'Problem: ' +
- While the cursor is still in cell D4, go to the Source tab and search for case
- Select the Case Title field
- Click Save, the Decision Table should like this:
Testing
In the standard Customer Self-Service Portal navigate to My Support and click on the Open a New Case button. Change the Case Type field to trigger the formula.
The form when it loads:
When the Case Type is set to Question, the Subject field is hidden and the Contact field is disabled
When the Case Type is set to Problem, the Subject field is shown and set to required, the Contact field is enabled and the Case Title is prefixed with Problem: