function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ryan Berens 9Ryan Berens 9 

Boolean field in FLOW sends EMPTY STRING when using Conditional Visibility; Need a workaround!

Hi  - Trying to meet a requirement in a Flow to remove/show fields with conditional visibility. 

I'm running into EXPECTED BEHAVIOR (See article (https://help.salesforce.com/articleView?id=flow_considerations_design_conditional_visibility.htm&type=0)), but I need a workaround.

ISSUE
When a field is HIDDEN on a screen component because of Conditional Visibility, 3 scenarios occur:
  • Boolean field is HIDDEN, value is FALSE; Flow sends EMPTY STRING. Result: Flow error, data type mismatch
  • Boolean field is SHOWN, value is FALSE; Flow send NULL. Result: Good.
  • Boolean field is SHOWN, value is TRUE; Flow sends TRUEResult: Good.
Solution #1:
Created a Flow FORMULA to evaluate the boolean field  - (IF(NOT({!Field}),TRUE,FALSE)
  • Scenario 1: Boolean field on record is TRUE
    • Result: INCORRECT field value. Should be FALSE
  • Scenario 2: Boolean field on record is FALSE
    • Result. Good.
  • Scenario 3: Boolean field on record is TRUE
    • Result. Good. 
Soltuion 2 - this is CRAZY
Created a Flow FORMULA to see if the value from the screen field is EMPTY STRING, and if it is,  then convert to NULL. 
Only Scenario: ERROR> Error Occurred: This error occurred when the flow tried to create records: INVALID_TYPE_ON_FIELD_IN_RECORD: Known: value not of required type: . You can look up ExceptionCode values in the SOAP API Developer Guide.

IN SUMMARY:
  • I need Conditional visibiliy to meet requirement
  • When a field is HIDDEN as expected, it send EMPTY STRING
  • When I use formulas to convert it to FALSE, I get two wrong outcomes
    • 1: Sets it to the oppositve of the value needed for boolean
    • 2: if checking for EMTPY STRING, hits error reflecting wrong data type.
SCREEN SHOT 1 - FIELD HIDDEN - SENDS EMPTY STRING
User-added image

SCREEN SHOT 2 - FIELD SHOWN, BUT BLANK - SENDS FALSE

User-added image

Here's the "Make Known" criteria in the screen.
User-added image


Help! What is the best workaround if you do, in fact, need to make 20+ checkboxes visible or hidden based on 7 distinct use cases?
Best Answer chosen by Ryan Berens 9
Mairtin ComeyMairtin Comey
Just ran into this same problem and got around it by creating a boolean formula for each dynamic checkbox. I found the solution here (https://developer.salesforce.com/forums/?id=9062I000000XoR1QAK).

IF({!checkbox.output}, TRUE, FALSE)

All Answers

Mairtin ComeyMairtin Comey
Just ran into this same problem and got around it by creating a boolean formula for each dynamic checkbox. I found the solution here (https://developer.salesforce.com/forums/?id=9062I000000XoR1QAK).

IF({!checkbox.output}, TRUE, FALSE)
This was selected as the best answer
Ryan Berens 9Ryan Berens 9
Thank you!!

For whatever reason, the "NOT" operator, or using a different evaluation criteria --> IF({!checkbox.output}=TRUE, TRUE, FALSE) both result in incorrect fields value.

I wonder why evaluating just the checkbox provides the correct values, but adding operators to that raw output gets translated incorrectly?? Food for thought.
Tony KirumbaTony Kirumba
Running into the same issue and the formula suggested isn't working. Might opt for the radio button solution instead (https://developer.salesforce.com/forums/?id=9062I000000XoR1QAK)
Tim Lomison 6Tim Lomison 6
It looks like the formulas in Flow will not evaluate properly if there is a null Boolean currently.  I did find a workaround where after the Screen I did an Assignment and assigned the screen component checkbox to a Variable (Text).  I then used that Variable in a Formula (Boolean), and used that Formula in my final Assignment/Record Update mapping to the record's field.

Formula: IF({!tempCheckboxVar} = "true", TRUE, FALSE)