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
Sylvie SerpletSylvie Serplet 

Validation rules on multiple fields when opportunity is closed

Hi,
I am trying to set a validation rules when an opportunity is closed won. 
When  IsWon is true and the record type is MyRecordType all the following fields need to be completed (fields 1,2,3 are picklists and field 4 is date).
My code is:
AND( 
IsWon = true, 
$RecordType.Name = "myrecordtype", 
ISBLANK(TEXT(field1)), 
ISBLANK(TEXT(field2)), 
ISBLANK(TEXT(field3)), 
ISBLANK(field4) 
)
The rule works the first time the user try to close the opportunity, but if only one field (field 1 for example) is completed, the rule does not execute again and the opportunity can be closed even if the 3 other fields are empty. Is it a normal behaviour or my validation is wrong?

Thank you for your help.
Sylvie  
 
Best Answer chosen by Sylvie Serplet
Raj VakatiRaj Vakati
Try this 
 
AND( 
IsWon = true, 
$RecordType.Name = "myrecordtype", 
OR(
ISBLANK(TEXT(field1)), 
ISBLANK(TEXT(field2)), 
ISBLANK(TEXT(field3)), 
ISBLANK(field4) 
)
)

 

All Answers

Raj VakatiRaj Vakati
Try this 
 
AND( 
IsWon = true, 
$RecordType.Name = "myrecordtype", 
OR(
ISBLANK(TEXT(field1)), 
ISBLANK(TEXT(field2)), 
ISBLANK(TEXT(field3)), 
ISBLANK(field4) 
)
)

 
This was selected as the best answer
Sylvie SerpletSylvie Serplet
Thank you Raj, it works.