I’ll provide a complete solution based on extensive experience with benefits form business rules across multiple release versions.
Regarding business rule syntax: Your current rule syntax is correct for basic scenarios but needs enhancement for saved enrollment contexts. The condition evaluation must account for the form’s initialization state. Here’s the corrected rule structure:
<rule id="showDependentFields"
event="onLoad,onChange"
priority="100">
<condition>
(planSelection.value == 'FAMILY' ||
planSelection.savedValue == 'FAMILY') &&
planSelection.initialized == true
</condition>
<action>
setVisible('dependentSection', true);
refreshSection('dependentSection');
</action>
</rule>
The key additions are: (1) checking both current value and savedValue to handle view mode, (2) verifying the field is initialized before evaluation, (3) binding to both onLoad and onChange events, and (4) explicitly refreshing the section after visibility changes.
For condition evaluation: The evaluation engine behaves differently depending on form mode. During enrollment, conditions evaluate against real-time field values. In view mode, the engine evaluates against persisted data, but that data isn’t always available at the initial rule execution moment. You need to implement a two-phase evaluation pattern. Add a secondary rule that re-evaluates visibility after a short delay:
<rule id="revalidateVisibility"
event="onLoad"
delay="500"
priority="50">
<action>executeRule('showDependentFields');</action>
</rule>
Regarding form event triggers: The event trigger configuration in your benefits form template needs specific settings for saved enrollment handling. In the form XML, ensure the root element includes: loadSavedData=“true” and evaluateRulesOnLoad=“true”. Without these attributes, rules won’t properly process saved values. Additionally, verify that your dependentSection has the attribute persistVisibility=“false” - this prevents the form from saving the visibility state itself, ensuring rules always control visibility based on current data.
For rule execution order: Priority values determine execution sequence, with higher numbers executing first. Your visibility rules should have priority 100 or higher to ensure they execute before any data validation rules (which typically run at priority 50). However, there’s a critical interaction with benefits-specific rules. If you have eligibility rules or premium calculation rules, those must execute before visibility rules. Set eligibility rules to priority 200, calculation rules to 150, and visibility rules to 100. This order ensures that when visibility changes, all dependent calculations have already completed.
One often-missed configuration is the rule scope setting. In Manage Benefits, navigate to your benefit plan configuration and verify that the business rules are associated with the correct enrollment period and plan type. Rules can be scoped to specific periods, and if your enrollment period has changed or been renewed, the rules might not be active for the current period even though they appear in the configuration.
Another critical aspect is field data binding in saved enrollment contexts. The planSelection field must be configured with dataBinding=“bidirectional” in the form XML. This ensures that when the form loads saved data, the field value is properly synchronized with the business rule engine’s evaluation context. Unidirectional binding (the default) only updates the display but doesn’t notify the rule engine of the loaded value.
For complex conditional logic involving multiple plan types, implement a rule state management pattern. Create a hidden field that stores the current visibility state and use it as an intermediate variable:
<!-- Hidden state field -->
<field id="dependentFieldsState" type="hidden" />
<!-- State management rule -->
<rule id="updateVisibilityState" priority="150">
<condition>planSelection.value == 'FAMILY'</condition>
<action>setValue('dependentFieldsState', 'visible');</action>
</rule>
<!-- Visibility application rule -->
<rule id="applyVisibility" priority="100">
<condition>dependentFieldsState == 'visible'</condition>
<action>setVisible('dependentSection', true);</action>
</rule>
This two-rule pattern provides more reliable evaluation because the state field explicitly tracks the intended visibility independently of the form mode.
Finally, after implementing these changes, clear all cached form definitions. In Admin Center > Clear Cache, select ‘Benefits Form Cache’ and clear it completely. Cached forms can retain old rule configurations even after updates are saved. Test thoroughly in both enrollment mode and view mode, and verify the behavior across different browsers as JavaScript execution timing can vary slightly between browsers, affecting rule evaluation order.