When deploying a Lightning page (FlexiPage), Salesforce may fail validation with a message like:
The filter logic references an undefined filter: 6.
This happens when a FlexiPage component visibility rule contains filter logic that references a criteria number that doesn’t exist in that rule.
What causes this error?
FlexiPages can include component visibility rules that contain:
booleanFilter (the logical expression)
one or more criteria entries (the items the logic refers to)
<visibilityRule>
<booleanFilter>(1 OR 2 OR 3) AND (4 OR 5 OR 6)</booleanFilter>
<criteria>
<!-- example criteria 1 -->
</criteria>
<criteria>
<!-- example criteria 2 -->
</criteria>
<criteria>
<!-- example criteria 3 -->
</criteria>
<criteria>
<!-- example criteria 4 -->
</criteria>
<criteria>
<!-- example criteria 5 -->
</criteria>
</visibilityRule>
This tells Salesforce:
evaluate criteria 1
OR criteria 2
OR criteria 3
AND (criteria 4
OR criteria 5
OR criteria 6)
But the rule only contains five <criteria> blocks, so Salesforce can’t evaluate criteria “6”, and will throw:
Or in other words, the <booleanFilter> references missing <criteria>.
How to identify the issue in Gearset
In Compare and deploy, open the FlexiPage metadata and search for:
<booleanFilter><criteria>
This can take a while to debug, depending on the size of the FlexiPage and how many components include visibility rules. It might be worth checking any recent changes first, in case they’ve caused the issue.
How to fix it
Your fix depends on what the page visibility rule is meant to do.
Option 1 - Simplify the booleanFilter
If the rule is only meant to evaluate criteria that currently exist, update:
<booleanFilter>(1 OR 2 OR 3) AND (4 OR 5 OR 6)</booleanFilter>
To:
<booleanFilter>(1 OR 2 OR 3) AND (4 OR 5)</booleanFilter>
This matches the <criteria> entries present.
Option 2 - Restore missing criteria
If the FlexiPage is meant to check multiple criteria, re-add the missing <criteria> blocks so that the numbering aligns with the booleanFilter:
<visibilityRule>
<booleanFilter>(1 OR 2 OR 3) AND (4 OR 5 OR 6)</booleanFilter>
<criteria>
<!-- example criteria 1 -->
</criteria>
<criteria>
<!-- example criteria 2 -->
</criteria>
<criteria>
<!-- example criteria 3 -->
</criteria>
<criteria>
<!-- example criteria 4 -->
</criteria>
<criteria>
<!-- example criteria 5 -->
</criteria>
<criteria>
<!-- example criteria 6 -->
</criteria>
</visibilityRule>
There are many different types of booleanFilter logic that can be used. This example is right when the logic “(1 OR 2 OR 3) AND (4 OR 5 OR 6)” is correct, but someone removed criteria accidentally.
Useful resources
Disclaimer: These errors are returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.
