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
DbjensenDbjensen 

Flow builder validation

Hello - Hoping someone can help out with a validation rule that's not working in flow. I have a screen elment with a text field called "Last_Name_1" and a text field called "Phone_1". If the last name is not blank, there must be a phone number. I cannot get the vaidation rule to fire. I tested the same validation rule on the object fields and it works as expected. Below is my validation rule.  

AND(
NOT(ISBLANK({!Last_Name_1})),
ISBLANK({!Phone_1}))

User-added image

 
Best Answer chosen by Dbjensen
Prakhar Saxena 19Prakhar Saxena 19
I guess it's because of this:
If the user leaves the field blank, and the field is not required, the flow doesn’t validate.
Validate Users’ Inputs with Flow Formulas (https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_designer_elements_screen_val.htm)

ISBLANK validation rule in a flow (https://success.salesforce.com/answers?id=90630000000Zhh2AAC)

As a workaround, you can add a decision after this screen and check the validity there. If it's invalid, redirect to a new error screen displaying the error message 'Please enter a phone number' and just give the Previous navigation option on the error screen (No Next/Finish).
 

All Answers

Prakhar Saxena 19Prakhar Saxena 19
Hi Dbjensen,

Just replace your input validation formula with this:
 
IF(AND(
NOT(ISBLANK({!Last_Name_1})),
ISBLANK({!Phone_1})), false, true)

Used "IF" operator which has three parameters (Logical condition, the value returned when the condition is true, the value returned when the condition is false)

https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5 (https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5)

Actually, we write the formula for error condition=true in validation rule but here in Flow input validation, we need to write error condition=false in order to make the validation work.

https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_designer_elements_screen_val.htm

Let me know if you have any issues.
DbjensenDbjensen
Hi Prakhar  - Unfortunately, this formula does't work either. I believe validation rules are already if statements so I don't believe that's required. Strange this isn't working. 
Prakhar Saxena 19Prakhar Saxena 19
I guess it's because of this:
If the user leaves the field blank, and the field is not required, the flow doesn’t validate.
Validate Users’ Inputs with Flow Formulas (https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_designer_elements_screen_val.htm)

ISBLANK validation rule in a flow (https://success.salesforce.com/answers?id=90630000000Zhh2AAC)

As a workaround, you can add a decision after this screen and check the validity there. If it's invalid, redirect to a new error screen displaying the error message 'Please enter a phone number' and just give the Previous navigation option on the error screen (No Next/Finish).
 
This was selected as the best answer
DbjensenDbjensen
Oh, that's a bummer. Ok, thanks for this workaround option. I appreciate the response.