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
Michael ColuzziMichael Coluzzi 

calculate a date from a picklist and a date field

Hi All,

I am looking to create a formula field that calculates a date in the future based on a date field value and a picklist. I was looking into using a CASE for this but keep recieving a syntax error.

CASE(Password_Expires_Every__c ,"30 Days", Password_Last_Changed__c + 30, "60 Days",Password_Last_Changed__c + 60,"90 Days", Password_Last_Changed__c + 90,"180 Days",Password_Last_Changed__c + 180,"One Year",Password_Last_Changed__c + 365)

Wondering if anyone can guide me to the issue! 

Thank you
Raj VakatiRaj Vakati
CASE(
Password_Expires_Every__c ,
"30 Days", DATETIMEVALUE(Password_Last_Changed__c) + 30,
 "60 Days",DATETIMEVALUE(Password_Last_Changed__c) + 60,
"90 Days", DATETIMEVALUE(Password_Last_Changed__c) + 90,
"180 Days",DATETIMEVALUE(Password_Last_Changed__c) + 180,
"One Year",DATETIMEVALUE(Password_Last_Changed__c) + 365
, NOW() 
)

 
Raj VakatiRaj Vakati
Use the above formula .. It will work as you expected