+ Start a Discussion
Tapas TuloTapas Tulo 

case function in process builder

Hi ,
 
   I have a field called EVENT Date(DATE FIELD) & EVENT FREQUENCY(PICKLIST[value 1 MONTHS,2Months,3Months...12Months etc...]).
REQUIREMENT: if I select any value from the event Frequency that value should be added to  the  event dates month.

EX- event date -10-02-2017
event frequency- 4 months
output would be-10-06-2017

here my code;
 CASE([Opportunity].Event_Frequency__c ,
"1 Month",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+1,day([Opportunity].Event_Date__c)),
"2 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+2,day([Opportunity].Event_Date__c)),
"3 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+3,day([Opportunity].Event_Date__c)),
"4 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+4,day([Opportunity].Event_Date__c)),
"5 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+5,day([Opportunity].Event_Date__c)),
"6 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+6,day([Opportunity].Event_Date__c)),
"7 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+7,day([Opportunity].Event_Date__c)),
"8 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+8,day([Opportunity].Event_Date__c)),
"9 Months",DATE(year([Opportunity].Event_Date__c),month([Opportunity].Event_Date__c)+9,day([Opportunity].Event_Date__c)),
DATE(year([Opportunity].Event_Date__c)+1,month([Opportunity].Event_Date__c),day([Opportunity].Event_Date__c)))

am not getting the output, there was no syntax error.

Thanks In advance.
 
jane1234jane1234

HI ,
please try this out ,it works
CASE([Account].Event_Frequency__c ,
"1 Month",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].1,DAY([Account].eventdate__c)),
"2 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].2,DAY([Account].eventdate__c)),
"3 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].3,DAY([Account].eventdate__c)),
"4 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].4,DAY([Account].eventdate__c)),
"5 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].5,DAY([Account].eventdate__c)),
"6 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].6,DAY([Account].eventdate__c)),
"7 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].7,DAY([Account].eventdate__c)),
"8 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].8,DAY([Account].eventdate__c)),
"9 Months",DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].9,DAY([Account].eventdate__c)),
'')
If u make event frequency field  as a number field  you can avoid case

and use below formula 
CASE([Account].Event_Frequency__c ,
DATE(YEAR([Account].eventdate__c),MONTH([Account].eventdate__c)+[Account].Event_Frequency__c,DAY([Account].eventdate__c))
 

Tapas TuloTapas Tulo
HI Seethal,
  Thanks For your earliest response.
  FYI 
   MY Event_Date__c && Event_Frequency__c  fields are on Opportunity object.
jane1234jane1234
helloo 
sorry for the error

this will work for sure ,Autually i done with account object,it worked well

CASE([Opportunity].Event_Frequency__c ,
"1 Month",DATE(YEAR([Opportunity].eventdate__c),MONTH(([Opportunity].eventdate__c)+1,DAY(([Opportunity].eventdate__c)),
"2 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+2,DAY([Opportunity].eventdate__c)),
"3 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+3,DAY([Opportunity].eventdate__c)),
"4 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+4,DAY([Account].eventdate__c)),
"5 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+5,DAY([Opportunity].eventdate__c)),
"6 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+6,DAY([Opportunity].eventdate__c)),
"7 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+7,DAY([Opportunity]eventdate__c)),
"8 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+8,DAY([Opportunity].eventdate__c)),
"9 Months",DATE(YEAR([Opportunity].eventdate__c),MONTH([Opportunity].eventdate__c)+9,DAY([Opportunity].eventdate__c)),
'')