Boolean result from subflow doesn’t work as condition for display text?

TL;DR

Why do I have to create a formula to use a boolean output variable as a visiblity condition in a flow? is there a better way to do this?

Detailed question:

I have a subflow (auto-launched) that has a boolean output variable. I’m trying to use this as a visiblity condition in a screen (component: Display Text). This is not working.

Subfow block:

enter image description here

Screen with condition:

enter image description here

I also created some test ones with a negated condition. After all, if TestOutput == true isn’t true, then TestOutput != true must be, right?:

enter image description here

Result of running it:

enter image description here

For some reason the only ones that are actually displayed are those that depend on a formula variable I created:

enter image description here

The subflow:

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>53.0</apiVersion>
    <assignments>
        <name>Assign</name>
        <label>Assign</label>
        <locationX>176</locationX>
        <locationY>218</locationY>
        <assignmentItems>
            <assignToReference>TestOutput</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>TestInput</elementReference>
            </value>
        </assignmentItems>
    </assignments>
    <interviewLabel>Demo_NestedFlow {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Demo_NestedFlow</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>CanvasMode</name>
        <value>
            <stringValue>FREE_FORM_CANVAS</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>OriginBuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processType>AutoLaunchedFlow</processType>
    <start>
        <locationX>50</locationX>
        <locationY>50</locationY>
        <connector>
            <targetReference>Assign</targetReference>
        </connector>
    </start>
    <status>Active</status>
    <variables>
        <name>TestInput</name>
        <dataType>Boolean</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
    </variables>
    <variables>
        <name>TestOutput</name>
        <dataType>Boolean</dataType>
        <isCollection>false</isCollection>
        <isInput>false</isInput>
        <isOutput>true</isOutput>
    </variables>
</Flow>

The screen flow:

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>53.0</apiVersion>
    <formulas>
        <name>DemoNested_Formula_False</name>
        <dataType>Boolean</dataType>
        <expression>{!DemoNested_False.TestOutput}</expression>
    </formulas>
    <formulas>
        <name>DemoNested_Formula_True</name>
        <dataType>Boolean</dataType>
        <expression>{!DemoNested_True.TestOutput}</expression>
    </formulas>
    <interviewLabel>Demo_CallingFlow {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Demo_CallingFlow</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>CanvasMode</name>
        <value>
            <stringValue>FREE_FORM_CANVAS</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>OriginBuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processType>Flow</processType>
    <screens>
        <name>ScreenApiName</name>
        <label>ScreenLabel</label>
        <locationX>675</locationX>
        <locationY>179</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>true</allowPause>
        <fields>
            <name>Display_DemoNested_True</name>
            <fieldText>&lt;p&gt;Flow result (true) should be true, making this visible.&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_True.TestOutput</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>true</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Display_DemoNested_True_NotEquals</name>
            <fieldText>&lt;p&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;Flow result (true): If that isn&apos;t visible, this should be, right?&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 85, 255);&quot;&gt;&lt;/span&gt;&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_True.TestOutput</leftValueReference>
                    <operator>NotEqualTo</operator>
                    <rightValue>
                        <booleanValue>true</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Display_DemoNested_Formula_True</name>
            <fieldText>&lt;p&gt;Formula result (true) should be true, making this visible&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_Formula_True</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>true</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Display_DemoNested_False</name>
            <fieldText>&lt;p&gt;Flow result (false) should be false, making this visible.&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_False.TestOutput</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>false</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Display_DemoNested_False_NotEquals</name>
            <fieldText>&lt;p&gt;&lt;span style=&quot;background-color: rgb(255, 255, 255); color: rgb(255, 0, 0);&quot;&gt;Flow result (false): If that isn&apos;t visible, this should be, right?&lt;/span&gt;&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_False.TestOutput</leftValueReference>
                    <operator>NotEqualTo</operator>
                    <rightValue>
                        <booleanValue>false</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <fields>
            <name>Display_DemoNested_Formula_False</name>
            <fieldText>&lt;p&gt;&lt;span style=&quot;color: rgb(62, 62, 60); background-color: rgb(255, 255, 255);&quot;&gt;Formula result (false) should be false, making this visible&lt;/span&gt;&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
            <visibilityRule>
                <conditionLogic>and</conditionLogic>
                <conditions>
                    <leftValueReference>DemoNested_Formula_False</leftValueReference>
                    <operator>EqualTo</operator>
                    <rightValue>
                        <booleanValue>false</booleanValue>
                    </rightValue>
                </conditions>
            </visibilityRule>
        </fields>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <start>
        <locationX>50</locationX>
        <locationY>50</locationY>
        <connector>
            <targetReference>DemoNested_True</targetReference>
        </connector>
    </start>
    <status>Active</status>
    <subflows>
        <name>DemoNested_False</name>
        <label>DemoNested_False</label>
        <locationX>402</locationX>
        <locationY>199</locationY>
        <connector>
            <targetReference>ScreenApiName</targetReference>
        </connector>
        <flowName>Demo_NestedFlow</flowName>
        <inputAssignments>
            <name>TestInput</name>
            <value>
                <booleanValue>false</booleanValue>
            </value>
        </inputAssignments>
        <storeOutputAutomatically>true</storeOutputAutomatically>
    </subflows>
    <subflows>
        <name>DemoNested_True</name>
        <label>DemoNested_True</label>
        <locationX>215</locationX>
        <locationY>198</locationY>
        <connector>
            <targetReference>DemoNested_False</targetReference>
        </connector>
        <flowName>Demo_NestedFlow</flowName>
        <inputAssignments>
            <name>TestInput</name>
            <value>
                <booleanValue>true</booleanValue>
            </value>
        </inputAssignments>
        <storeOutputAutomatically>true</storeOutputAutomatically>
    </subflows>
</Flow>

Why can’t I use these values directly? Am I doing something wrong?

Answer

Attribution
Source : Link , Question Author : DiplomacyNotWar , Answer Author : Community

Leave a Comment