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
Vanessa RamicVanessa Ramic 

Validation rule OR function

I have a formula that currently works. Basically, if Investment Name is XYZ, then filling in the Total Size is required.
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"))

I want to add additional consideration for another picklist field. I want the above to kick in only if Type_c field is equal to “Addition”  OR  “New Investment”.  

I am not sure how to add this. Can anyone help?
 
Best Answer chosen by Vanessa Ramic
Abdul KhatriAbdul Khatri
Hi Vanessa

Any of the solutions should work.
 
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"), OR(ISPICKVAL(Type__c, "Addition"), ISPICKVAL(Type__c, "New Investment")))

OR
 
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"), OR(TEXT(Type__c) = "Addition",TEXT(Type__c) = "New Investment"))

I hope this will help

All Answers

Abdul KhatriAbdul Khatri
Hi Vanessa

Any of the solutions should work.
 
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"), OR(ISPICKVAL(Type__c, "Addition"), ISPICKVAL(Type__c, "New Investment")))

OR
 
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"), OR(TEXT(Type__c) = "Addition",TEXT(Type__c) = "New Investment"))

I hope this will help
This was selected as the best answer
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Vanessa,

Can you try the below solution. 

We are adding OR condition for the two values of Type_c field as below and Adding whole into AND()
AND(ISBLANK(TEXT(Total_Size_c)), ISPICKVAL(Investment_Name_c,"XYZ"),OR(ISPICKVAL(Type_c,"Addition"),ISPICKVAL(Type_c,"New Investment")) )
Type_c
 
Vanessa RamicVanessa Ramic
Than you both. This worked!