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
Chirag Verma 13Chirag Verma 13 

Need to a write validation if Last_Month__c = June then we can enter values upto June_c only

Hi,

My requirement is when ever we enter Last_Month__c  = June then we should able to enter Amount values upto June Month only. If we
try to enter July month to till December then that it should throw an error.

Note - There is a field called Starting_month__c so we enter a valuein that field for idea purpose when will be the starting month.

Last_Month__c is Picklist field and January , February, so on fields data type = 'Number'.

This sceniero is possible through validation rule or workflow or Process builder or trigger.

Please Suggest.

Thanks,
Chirag verma.
AbhimanyuAbhimanyu
Hi Chirag,

One question, do you have a seperate field for Amount for each month, if yes then what is its API Name?
Chirag Verma 13Chirag Verma 13
Yes we have separate field for every month.
 January__c,February__c,March__c,April__c,May__c,June__c,July__c,August__c,September__c,October__c,November__c,December__c
AbhimanyuAbhimanyu
Hi

Create a new Validation Rule 

OR( 
    AND (ISPICKVAL(Last_Month__c,'1'),ISBLANK(January__c)),
    AND (ISPICKVAL(Last_Month__c,'2'),OR (ISBLANK(January__c),ISBLANK(February__c))),
    AND (ISPICKVAL(Last_Month__c,'3'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c))),
    AND (ISPICKVAL(Last_Month__c,'4'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c))),
    AND (ISPICKVAL(Last_Month__c,'5'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c))),
    AND (ISPICKVAL(Last_Month__c,'6'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c))),
    AND (ISPICKVAL(Last_Month__c,'7'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c))),
    AND (ISPICKVAL(Last_Month__c,'8'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c),ISBLANK(August__c))),
    AND (ISPICKVAL(Last_Month__c,'9'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c),ISBLANK(August__c),ISBLANK(September__c))),
    AND (ISPICKVAL(Last_Month__c,'10'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c),ISBLANK(August__c),ISBLANK(September__c),ISBLANK(October__c))),
    AND (ISPICKVAL(Last_Month__c,'11'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c),ISBLANK(August__c),ISBLANK(September__c),ISBLANK(October__c),ISBLANK(November__c))),
    AND (ISPICKVAL(Last_Month__c,'12'),OR (ISBLANK(January__c),ISBLANK(February__c),ISBLANK(March__c),ISBLANK(April__c),ISBLANK(May__c),ISBLANK(June__c),ISBLANK(July__c),ISBLANK(August__c),ISBLANK(September__c),ISBLANK(October__c),ISBLANK(November__c),ISBLANK(December__c)))    
)


Mark this as best answer if it helped. 
Chirag Verma 13Chirag Verma 13
Hello Abhimanyu,

Thanks for reply, But it worked with the  ISPICKVAL(Latest_Month__c,'Jan'), NOT( ISBLANK(January__c) ),

Anyways Thanks.!