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
PrasunnaPrasunna 

Validation rule for Opportunity Record Type

Hi All,

I created a validation rule On opportunity record type. When Opportunity Satge is closed and won picklist filed1 and picklist field2 must be populated. So that I created a validation rule like this:

AND(
     OR(ISPICKVAL( StageName , "Closed Won") ),  
     OR($RecordType.Name =  " Rec1 " ), 
     OR(ISPICKVAL(  Picklistfield1, ""  ),
        ISPICKVAL(  Picklistfield2 , "" ))
    )

It is not showing any errors. But it is not working. Can anyone have idea about this?

Thanks in Advance,
Pavithra.
Best Answer chosen by Prasunna
kevin lamkevin lam
Your validation rule should look like this:
AND(ISPICKVAL(StageName, "Close Won"),
         $RecordType.Name = "Rec1",
         OR(ISBLANK(TEXT(Picklistfield1)),
                ISBLANK(TEXT(Picklistfield2))
              )
        )

All Answers

kevin lamkevin lam
Your validation rule should look like this:
AND(ISPICKVAL(StageName, "Close Won"),
         $RecordType.Name = "Rec1",
         OR(ISBLANK(TEXT(Picklistfield1)),
                ISBLANK(TEXT(Picklistfield2))
              )
        )
This was selected as the best answer
Amit Chaudhary 8Amit Chaudhary 8
Please try to update your validarion rule like below
 
AND
(	
	ISPICKVAL(StageName, "Closed Won"),
    $RecordType.Name = "Rec1",
    OR
	(
		ISBLANK(TEXT(Picklistfield1)),
		ISBLANK(TEXT(Picklistfield2))
    )
)
Or
AND
(	
	ISPICKVAL(StageName, "Closed Won"),
    $RecordType.Name = "Rec1",
    OR
	(
		ISPICKVAL(  Picklistfield1, ""  ),
		ISPICKVAL(  Picklistfield2 , ""  )
    )
)
Let us know if this will help you

Thanks
Amit Chaudhary
 
PrasunnaPrasunna
Thanks Kevin & Amit for your help
PrasunnaPrasunna
Both answers are best ones. Thank you so much to both of you. FCFS, so that i marked for Kevin.

Thank you,
Pavithra.