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
Peyman HeydariPeyman Heydari 

case

User-added imageHi, I am getting this error when trying to save this formula. Any idea what I need to do to fix this? Thanks so much. 
Best Answer chosen by Peyman Heydari
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Peyman,

Can you try the below logic, Case may not work in this scenerio
 
If( Likely_Decision_Date__c > (TODAY() + 31), 'warm' , IF( Likely_Decision_Date__c < (TODAY() + 30),'Hot',Cold))


Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Peyman,

Can you share the formula as comment as it is hard to understand from screenshot and also let us know what you are trying to achieve here.

Thanks,
 
Peyman HeydariPeyman Heydari
Sure, the formula is: 
CASE( Rating ,  Likely_Decision_Date__c >  TODAY() + 31, "Warm", Likely_Decision_Date__c <  TODAY() + 30, "Hot", "Cold")

The error is:  Incorrect parameter type for function 'CASE()'. Expected , received Boolean
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Peyman,

Can you try the below logic, Case may not work in this scenerio
 
If( Likely_Decision_Date__c > (TODAY() + 31), 'warm' , IF( Likely_Decision_Date__c < (TODAY() + 30),'Hot',Cold))


Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
This was selected as the best answer
Peyman HeydariPeyman Heydari
Hi Sai,
I was able to save your formula with no errors, however it does not work on the Lead page. For example, I tried to create a new record with the "Likely Decision Date" of 10-28-22 which is less than 30 days, in this case the Rating is suppose to change to Hot, but Rating did not change at all. 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Peyman,

In this scenerio you should not be using formula. When you use formule then the formula field itself will change not the other field. Which means the formula field which you created will change to Hot, cold or warm. If you want the above you may have to use flow .

Thanks,
 
Peyman HeydariPeyman Heydari
Actually, it's working. Thanks so much!