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
TigerPowerTigerPower 

Picklist & text field validation rule help needed

I have a working validation rule that has to be updated. Now the validation rule checks that either picklist field is selected or text field has user input (some value)


AND(
NOT(ISBLANK(TEXT(PicklistField__c ))),
NOT(ISBLANK(Text_field__c)))

This validation rule still has to work like this in the most of the cases, but there will be one new condition:
IF Another_Picklist__c has value "ABC",
user may not select PicklistField__c or fill in Text_field__c

So now there is a third field which has to be added to the already existing rule.

If Another_Picklist__c is not "ABC", the old rule should trigger just the way it is triggered right now:
AND(
NOT(ISBLANK(TEXT(PicklistField__c ))),
NOT(ISBLANK(Text_field__c)))

But if Another_Picklist equals "ABC", then user may not select PicklistField or add
value to Text_field.

Makes sense?

 

This is what I tried to do:


IF(NOT(ISPICKVAL(Another_Picklist__c, "ABC")),

(AND(
NOT(ISBLANK(TEXT(PicklistField__c ))),
NOT(ISBLANK(Text_Field__c)))),

(AND(
ISBLANK(TEXT(PicklistField__c)),
(ISBLANK(Text_Field__c)))
))

 

What happens here is that the end of the rule is not working alright. Any ideas what I'm doing wrong here?

 

Regards,

TP

ritika@developerforceritika@developerforce

Hi,

 

I think you can simplify the formula. From what I understand, you need to bypass the blank check for picklist and text field if the other picklist is ABC. Check this out -

 

AND ( ISBLANK(TEXT(PicklistField__c )) , ISBLANK(Text_field__c) , NOT(ISPICKVAL(Another_Picklist__c, "ABC")) )

 

This will evaluate to true (error condition in a validation rule) if -

1. Another Picklist != ABC and both Picklist field and text field are empty.

 

This rule will pass (no error) - false evaluation

1. Another picklist = ABC

2. Another Picklist != ABC and Picklist field has value

3. Another Picklist != ABC and Text Field has value

4. Another Picklist != ABC and both Picklist field and text field have values

 

Hope this helps

 

Regards,

Ritika

Kate BrownKate Brown
I am trying a similar validation rule and getting a syntax error.  I have a picklist field and a text field.  I want that if the picklist answer is corrugated, then the text field is required.  Here is what I have:

AND (ISPICKVAL(BP_Product_Line__c, "Corrugated")), ISBLANK(Shape__c)

Any help would be appreciated.