Conditional Filters can be defined on numerous concepts to only render them when a specific condition is met. For example, a field on a form can be configured to only display when the form is in a specific state using a conditional filter.
Below is a list of all the concepts that support conditional filters:
- Forms
- Tabs
- Fields
- Commands
- State Transitions
- Documents
- Field Options
- Sections
- Wizards
- Generic Actions
A Conditional Filter includes the following default fields along with their purpose:
- Name – The name of the conditional filter.
- Filter Type – This determines what type of conditional filter this is and what additional fields to display.
- Filter by role – Any roles that are required for this conditional filter to be satisfied.
- Filter by state – Any states that the instance must be in for this conditional filter to be satisfied
- Condition used by – Displays all the tabs, fields, etc. that are using this conditional filter.
Depending on the Filter Type you will see different fields:
- Role/State Only
- This is the default option, it does not contain any additional fields
- Custom
- Custom code to evaluate condition – This is a target information field that you can populate that will make a call to a target to determine if the conditional filter is satisfied or not. The target must return “Y” meaning the condition is satisfied or “N” meaning the condition is not satisfied. The Return Option must be String.
- Content
- Which XML field will be tested – Enter the XML Element name of the field you want to get the value of to test.
- What condition is being tested – Determines what type of test will be made to check if the conditional filter is satisfied.
- What value is being tested against – What value do you want to test against the XML field value, this field is optional depending on the test condition.
- Configuration Parameter
- Which configuration parameter will be tested – Enter the name of the configuration parameter you want to test the value of.
- What condition is being tested – Determines what type of test will be made to check if the conditional filter is satisfied.
- What value is being tested against – What value do you want to test against the configuration parameter value, this field is optional depending on the test condition.
Conditional Filters let you provide a tailored user experience for a Form when you only want to display specific things such as tabs and fields under special conditions.
A Concept Form should be used to display all the common features of every record of a Concept. For example, a Concept Form for an insurance policy management system would be an insurance policy. The Insurance Policy Concept Form would define all the common functionality of an insurance policy. This would include fields such as Policy ID, Effective Date, and other fields that any policy would need. An insurance policy may also have common state transitions, workflow, reports, and documents.
However, there are many different types of insurance policies that may require extra fields or workflow. For example, auto insurance, small business insurance, or property insurance. We could create separate Concept Forms for each of these insurance policy types but that can lead to a complex user experience and duplication of common code. A better approach is to use Conditional Filters on specific tabs and fields.
To achieve this you’ll first need a field that contains a list of Insurance Types on the form. Secondly, create a Conditional Filter for each Insurance Type (Auto, Small Business, Property, etc.) and input the name of the XML Element of the Insurance Type field into the Field textbox when creating the Conditional Filter. Lastly, create all the fields and tabs for the different insurance types and specify which conditional filter should be applied to the field/tab your creating.
Now when the Insurance Type is updated only fields and tabs with that Conditional Filter applied to them will be visible.
Previous article: Creating Form Definitions using trellispark UX Creator
Next article: Creating an Application Form Definition