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
joe27joe27 

Need validation rule plz help

Hello all

 

I  am looking for a validation rule to say

 

if a picklist field is populated then 4 other text  fields are required .

 

AND ((text( Board_1_Menu_Design__c ) != null), picklist field

(( Board_1_Display_Length__c ) = null) ,
(( Board_1_Display_Width__c ) = null) ,
(( Board_1_Print_Width__c ) = null) ,
(( Board_1_Print_Length__c ) = null))

 

I need it so that if i select an option from the picklist field all other fields are required ..at the moment i can save if i only populate 1 of the text fields

 

 

Best Answer chosen by Admin (Salesforce Developers) 
CheyneCheyne

Use ISPICKVAL to check if the picklist is populated. You can do this with NOT(ISPICKVAL(Board_1_Menu_Design__c, "")).  When this returns true, the picklist is populated. Also use ISBLANK to check if a text field has a null value: ISBLANK(Board_1_Display_Length__c) returns true if Board_1_Display_Length__c is null.

 

Combining the above formulas, you get

IF(NOT(ISPICKVAL(Board_1_Menu_Design__c, "")),
   OR(
      ISBLANK(Board_1_Display_Length__c),
      ISBLANK(Board_1_Display_Width__c),
      ISBLANK(Board_1_Print_Width__c),
      ISBLANK(Board_1_Print_Length__c)
), false)

 This checks if Board_1_Menu_Design is populated. If it is, then it checks if any of the four text fields are null (using OR). If any one of them is null, it returns true (validation error). If none of them are null, it returns false. If Board_1_Menu_Design is not populated, it returns false.

All Answers

CheyneCheyne

Use ISPICKVAL to check if the picklist is populated. You can do this with NOT(ISPICKVAL(Board_1_Menu_Design__c, "")).  When this returns true, the picklist is populated. Also use ISBLANK to check if a text field has a null value: ISBLANK(Board_1_Display_Length__c) returns true if Board_1_Display_Length__c is null.

 

Combining the above formulas, you get

IF(NOT(ISPICKVAL(Board_1_Menu_Design__c, "")),
   OR(
      ISBLANK(Board_1_Display_Length__c),
      ISBLANK(Board_1_Display_Width__c),
      ISBLANK(Board_1_Print_Width__c),
      ISBLANK(Board_1_Print_Length__c)
), false)

 This checks if Board_1_Menu_Design is populated. If it is, then it checks if any of the four text fields are null (using OR). If any one of them is null, it returns true (validation error). If none of them are null, it returns false. If Board_1_Menu_Design is not populated, it returns false.

This was selected as the best answer
Madhan Raja MMadhan Raja M

Try this formula:

 

AND( NOT( ISBLANK( TEXT(Board_1_Menu_Design__c) ) ) , OR( ISBLANK( Board_1_Display_Length__c) , ISBLANK(Board_1_Display_Width__c) , ISBLANK( Board_1_Print_Width__c) , ISBLANK(Board_1_Print_Length__c) ))

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

Madhan Raja M