When deploying a Flow, Salesforce may fail validation with a message like:
field integrity exception: unknown (Invalid condition logic: The filter logic references an undefined filter: 2.)
This happens when a Flow Decision outcome contains condition logic that references condition numbers that don’t exist in that outcome.
What causes this error?
Flow Decisions can have outcomes that contain:
conditionLogic (the logical expression)
one or more conditions (the items the logic refers to)
Example:
<rules>
<name>Broken_Example</name>
<conditionLogic>1 AND 2 AND 3</conditionLogic>
<conditions>
<!-- example condition 1 -->
</conditions>
</rules>
This tells Salesforce:
evaluate condition 1
and condition 2
and condition 3
But the outcome only contains one <conditions> block, so Salesforce can’t evaluate condition “2” (or “3”), and will throw:
The filter logic references an undefined filter: 2.
or in other words, the <conditionLogic> references missing <conditions>.
How to identify the issue in Gearset
In Compare and deploy, open the Flow metadata and search for:
<conditionLogic><conditions>
This can take a while to debug, depending on the size of the Flow and number of conditionLogic blocks it contains. 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 Flow is meant to do.
Option 1 - Simplify conditionLogic
If the outcome is only meant to check a single condition, update:
<conditionLogic>1 AND 2 AND 3</conditionLogic>
To:
<conditionLogic>1</conditionLogic>
This matches the single <conditions> entry present.
Option 2 - Restore missing conditions
If the Flow is meant to check multiple conditions, re-add the missing <conditions> blocks so that the numbering aligns with the conditionLogic:
<rules>
<name>Fixed_Example</name>
<conditionLogic>1 AND 2 AND 3</conditionLogic>
<conditions>
<!-- example condition 1 -->
</conditions>
<conditions>
<!-- example condition 2 -->
</conditions>
<conditions>
<!-- example condition 3 -->
</conditions>
</rules>
There are many different types of conditionLogic that can be used. This example is right when the logic “1 AND 2 AND 3” is correct, but someone removed conditions 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.
