Making Fields Mandatory Based on Conditions
Status
Release Available | Status | Framework Name |
---|---|---|
4.1 | Current | Both Mui and Mint |
General
Portal admins can make one or more fields mandatory based on evaluation criteria. For example, from the passport number and driving license number fields, a user should provide details only for one of these fields.
Note:
- For every field when specifying the required condition check, add !=null condition.
- For date and datetime fields, the validation can only be done using the global variables and not with the hard-coded values.
Required field configuration as an expression along with true or false values
Code JSON
"required": "$this.attr(AnnualRevenue); > 1000", "messages": { "requiredErrorText": "Source of Income is mandatory when annua Revenue crosses 100K" },
Required field configuration as an expression along with true or false values for a list view
For a list view, when a field is conditionally required, show a tooltip with some text (conditionallyRequiredText
) to indicate that a particular field column is conditionally required.
Code JSON
"required": "$this.attr(Currency2__c); > 100", "messages": { "requiredErrorText": "Required value when min amount is greater than 100", "conditionallyRequiredText": "This field data is conditionally required based on $global.attr(minimumAmountFieldName); field data.This is sample additional tooltip text" },