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
vikas  malikvikas malik 

Validation rule help needed

1) i am having a picklist field called as "Type__c" if the value of type is set to "Other Adjustment"  then i am having other 2 picklist fields like "Month__c" and "Year__c" should be mandatory


IF(
AND(
NOT(
ISPICKVAL(Type__c, 'Other Adjustment')),ISBLANK( ADR_Move_From_Month__c),ISBLANK( ADR_Move_From_Year__c)), true, false)
Best Answer chosen by vikas malik
Gaurav NirwalGaurav Nirwal
IF(
AND(
NOT(
ISPICKVAL(Type__c, 'Other Adjustment')),ISBLANK( TEXT(ADR_Move_From_Month__c)),ISBLANK(TEXT(ADR_Move_From_Year__c))), true, false)

 

try this

All Answers

PratikPratik (Salesforce Developers) 
Hi Vikas,

Try this:

AND( ISPICKVAL(Type__c,"Other Adjustment"), 
   OR (ISPICKVAL(ADR_Move_From_Month__c,''),
   ISPICKVAL(ADR_Move_From_Year__c,'') )  )

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
PratikPratik (Salesforce Developers) 
Hi Vikas,

The above Rule will check: If Type__c is Other Adjustments and any one of picklistlist ADR_Move_From_Month__c or ADR_Move_From_Year__c is blank; it will throw error.

Thanks,
Pratik

 
@anilbathula@@anilbathula@
Hi vikas malik

use this validation rule:
 
AND(ISPICKVAL(Type__c, 'Other Adjustment'),ISBLANK(TEXT(ADR_Move_From_Month__c)),ISBLANK(TEXT( ADR_Move_From_Year__c)))

Thanks
Anil.B
Gaurav NirwalGaurav Nirwal
IF(
AND(
NOT(
ISPICKVAL(Type__c, 'Other Adjustment')),ISBLANK( TEXT(ADR_Move_From_Month__c)),ISBLANK(TEXT(ADR_Move_From_Year__c))), true, false)

 

try this
This was selected as the best answer