+ Start a Discussion
AAIAAI 

validation rule ispickval and is blank

Hi all,

I would need to validate differents options. If Lead Status is "Unqualified", Reason rejected must be filled but if lead status is open or pending or
qualified, the reason rejected must not be filled. Here is my code. Any help?
AND( 
ISPICKVAL(Status ,"Unqualified"), 
ISBLANK( ReasonRejectedByCommercialPlanning__c ))
OR
ISPICKVAL(Status ,"Open")
NOT (ISBLANK( ReasonRejectedByCommercialPlanning__c ))
||
ISPICKVAL(Status ,"Pending")
NOT (ISBLANK( ReasonRejectedByCommercialPlanning__c ))

Many thanks
Leo10Leo10
Hi,
you try this code
OR(
	AND(
		ISPICKVAL(Status ,"Unqualified"), 
		ISBLANK( ReasonRejectedByCommercialPlanning__c )
		),
	AND(
		OR(ISPICKVAL(Status ,"Open"), ISPICKVAL(Status ,"Pending")),
		NOT (ISBLANK( ReasonRejectedByCommercialPlanning__c ))
		)
)

Thank you,
Leo10Leo10
Hi,
If my answer helped you then please mark it as 'Best Answer' and solved this question.
If you still have any doubt please do let me know.
Thank you
AAIAAI
Hi Leo,

The VR doesn´t work well. When I choose any value, the error is displayed. I can´t save the text wrote in the field reason rejected.

I would appreciate any idea.

Many thanks,

Amaya

 
Leo10Leo10
Hi,
But this code is working fine for me. When the Lead Status is "Unqualified" then 'ReasonRejectedByCommercialPlanning__c' cannot be empty otherwise, an error will display. if the lead status is open or pending or qualified the 'ReasonRejectedByCommercialPlanning__c' can be empty and you can save your record.
 
OR(
	AND(
		ISPICKVAL(Status ,"Unqualified"), 
		ISBLANK( ReasonRejectedByCommercialPlanning__c )
		),
	AND(
		OR(ISPICKVAL(Status ,"Open"), ISPICKVAL(Status ,"Pending"), ISPICKVAL(Status ,"qualified")),
		NOT (ISBLANK( ReasonRejectedByCommercialPlanning__c ))
		)
)

Thank you
 
AAIAAI
Hi,

I´m afraid, that when I tried to save the comments in the reason rejected field, the information doesn´t save and the error is displayed.

I can´t figure out why. Could you give me any advise?.

Many thanks
Leo10Leo10
Hi
What type of error you are getting?. Can you share your screen shot?.
AAIAAI
Hi,

Here you are. When I try to save the comments in the reason rejected field, I cannot do it. Thanks for your help.

User-added image
Leo10Leo10
Hi,
Actually, it is working for me.
Do like this

From setup -> Lead -> Validation Rules -> New -> 

User-added image
 
OR(
	AND(
		ISPICKVAL(Status ,"Unqualified"), 
		ISBLANK( ReasonRejectedByCommercialPlanning__c )
		),
	AND(
		OR(ISPICKVAL(Status ,"Open"), ISPICKVAL(Status ,"Pending"), ISPICKVAL(Status ,"qualified")),
		NOT (ISBLANK( ReasonRejectedByCommercialPlanning__c ))
		)
)

* confirm that you are using the correct API name 'ReasonRejectedByCommercialPlanning__c '.
 
Thank you
Rashmi Tyagi 10Rashmi Tyagi 10
Hi Amaya,
Instead of IsBlank use IsNull in VR it will work.
Thanks,
Rashmi