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
AbAb 

Validation rule on Text field | Mandatory | Check size

Hello,

I have to implement 2 validation rule on a text field
1st one to check the required. (make field mandatory)
2nd one will be fired if 1st is OK. It will check if the field has 14 characters.

I also need a custom error messages.

Thank you for suggestions
Best Answer chosen by Ab
Dheeraj_UpadhyayDheeraj_Upadhyay

replace Address_Line_3__c with your Text Field name.

(Address_Line_3__c=null)||(LEN( Address_Line_3__c )<14)

All Answers

Dheeraj_UpadhyayDheeraj_Upadhyay

replace Address_Line_3__c with your Text Field name.

(Address_Line_3__c=null)||(LEN( Address_Line_3__c )<14)
This was selected as the best answer
Tim CaljeTim Calje

Hi Sandrine,

The solution as provided by Dheeraj is certainly correct, but if you require different custom messsages I suggest to create 2 seperate validation rules.

e.g:

Address_Line_3__c=null   -> Show the message that the field is required
AND(NOT(Address_Line_3__c=null),LEN(Address_Line_3__c)<14)  -> Show the message that the field does not contain 14 characters