-3

My below formula is showing a syntax error, Can anyone plz suggest where its gone wrong in syntax. I am using it in process builder.

I have a month picklist field in lead " renewal month", if the month choosen is less than current month, the task due date is next year, previous month. But if my choosen month is greater than current month (i.e now november & if i choose December), then it should be current year and previous month. Now all is perfect , only showing issue in second part i.e if my month is greater than the current month ( i.e choosen is December). , So most probably issue is my last part of the formula, for me seems its all perfect, can anyone plz try to figure out where i went wrong. thanks

IF(
CASE( [Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4,     
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)< MONTH(TODAY()),
IF(TEXT([Lead].Renewal_Month__c)="January",DATE(YEAR(TODAY()),12,1), 
DATE(YEAR(TODAY())+1,CASE([Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)-1,1)),

DATE(YEAR(TODAY()), CASE([Lead].Renewal_Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)-1, 1))
0

I tried same formula in my org. it saved without error but the small changes on your formmula. 1. [Lead.field] - u can use directly field no need of object.

IF(
CASE(Month__c ,
"January",1,
"February",2,
"March",3,
"April",4,     
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,0)< MONTH(TODAY()),
IF(TEXT(Month__c)="January",DATE(YEAR(TODAY()),12,1), 
DATE(YEAR(TODAY())+1,CASE(Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,0)-1,1)),

DATE(YEAR(TODAY()), CASE(Month__c,
"January",1,
"February",2,
"March",3,
"April",4, 
"May",5,
"June", 6,
"July", 7,
"August", 8,
"September",9,
"October", 10,
"November", 11,
"December", 12,NULL)-1, 1))
| improve this answer | |
  • Hi Shravan. thanks. have you tried in the process builder ? – sourav Nov 11 '16 at 6:05
  • when i used the process builder , i taken the record type as " Task" in teh immmediate action and the initial object aas " Lead", so when i am putting the formula and choosing from teh insert field its taking automatically the Lead object. – sourav Nov 11 '16 at 6:07
  • If i dont take the lead object , its showing me as " The formula expression is invalid: Field Renewal_Month__c does not exist. Check spelling." – sourav Nov 11 '16 at 6:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.