5

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?

2
  • 2
    I filed an internal bug for this. Even if you use a Number or Text output variable, the component visibility logic seems to work in the opposite manner. Your workaround or even just utilizing Manually assign variables in the subflow element work. Nov 19, 2021 at 17:43
  • @Kris A manually assign works? That's good to know. It's certainly less of a headache to define that for the flow than it is to create a formula. Thank you also for raising a bug. I wasn't sure if it was or if I was just doing something wrong. Nov 20, 2021 at 10:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.