+ Start a Discussion
KrawlsKrawls 

Creating a date validation formula based off of a picklist

Hello-
 
I would like to create a rule for a product servicing date that is based off of a piclist. For example, if we place a term life insurance policy for 27 years, I would like for the date field to calculate from the issue date 26 years out, or one less year than the term length. 
 
I currently have the term lenght in a picklist ranging from 5-30 to allow for any type of funky policy placement.  So I would like for the date to calculate based upon the number that is chosen in the picklist. 
 
Is this possible, if so, can someone please help?
JakesterJakester
Here's the deal with picklists. I know, it sucks.

You can work around it, though, especially in your scenario. The Case() function will be your friend here. Something like this:

Code:
case(length_picklist__c,
"5",your_date_to_validate__c < date(year(today()+5,month(today),day(today)),
"6",your_date_to_validate__c < date(year(today()+6,month(today),day(today)),
"This condition shouldn't happen"
)

 I picked Today() somewhat randomly - you probably have another date that you're going to want to use. Obviously you'll need to make another ~30 rows like the ones starting with "5" and "6". Have fun!

KrawlsKrawls
Hi -

Thank you so much for your help, I just have a few questions:

I tried your instructions and I have had a few problems.  Mostly, everytime I ask it to check the syntax it keeps telling me that I am missing a "("

I have read it over and over, and I cant find where the comma could be missing, so I thought I would give you a run down of what I tried:

  • "lenght_picklist_c" - I replaced with our merge field "Term Length," as that is the pick list that includes number of years - was that correct?
  • "your_date_to_validate_c" - I assume that you are saying I need to insert our own merge date which I used: Issued_date_c
  • The "date(year(today()+5,month(today),day(today))":  I initially tried it as is and then tried putting the merge field "created date" in there, but neither of those helped the situation.
  • I tried putting commas in various places, but then it kept saying that "date(year(today()" or "month(today),day(today))" were not merge feilds.  I assumed those were formula fields to I didnt customize them at all.
I am very new to creating rules etc.  So I apologize if these questions are very basic and I am missing something simple

Again, Thank you SO much for any help you can provide!!!!!!

Kendall