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
AlizehSAlizehS 

I have a custom formula field which converts a date field to text. Additionally i want it to only convert the date field to text based on Account type

Currently I am using the below formula in my formula field to convert a date field to string :
IF(ISBLANK( Fiscal_Year End _c),
NULL,
TEXT(DAY(Fiscal_Year End _c )) & " " &
CASE(
MONTH( Fiscal_Year End _c ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None" ) )
Additionally, we would want the formula to convert the date field to string only if the Account type is Prospect or Customer. Any ideas how I can format the formula ?
Best Answer chosen by AlizehS
AnkaiahAnkaiah (Salesforce Developers) 
Hi Alizeh,

Then try with below formula.
IF(ISBLANK( Fiscal_Year End__c),
NULL,
IF(OR(ISPICKVAL(Type,"Prospect"),ISPICKVAL(Type,"Customer")),TEXT(DAY(Fiscal_Year End _c )) & " " &
CASE(
MONTH( Fiscal_Year End _c ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None" ),TEXT(Fiscal_Year End__c)))

If this helps, Please mark it as best answer.

Thanks!!

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi,

try with below formula.
 
IF(ISBLANK( Fiscal_Year End _c),
NULL,
IF(OR(ISPICKVAL(Type,"Prospect"),ISPICKVAL(Type,"Customer")),TEXT(DAY(Fiscal_Year End _c )) & " " &
CASE(
MONTH( Fiscal_Year End _c ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None" ),NULL))

If this helps, Please mark it as best answer.

Thanks!!
AlizehSAlizehS
Hi @Ankaiah, Thank you so much for your help. To give you some context : I have a date field (Fiscal year end) and the formula field was initially created to convert the date field to string format. The current business requirement is such that the formula field should convert the date field to string only if the Account Type equals Prospect or Customer else it should display it in date format. The current formula ( provided by you ) does satisfy the condition of Account type but the latter part i.e if Account Type is anything other than Prospect or Customer it should display it in date format and not convert it to string is what I am looking for. Can this be done ?
AnkaiahAnkaiah (Salesforce Developers) 
Hi Alizeh,

Then try with below formula.
IF(ISBLANK( Fiscal_Year End__c),
NULL,
IF(OR(ISPICKVAL(Type,"Prospect"),ISPICKVAL(Type,"Customer")),TEXT(DAY(Fiscal_Year End _c )) & " " &
CASE(
MONTH( Fiscal_Year End _c ),
1, "January",
2, "February",
3, "March",
4, "April",
5, "May",
6, "June",
7, "July",
8, "August",
9, "September",
10, "October",
11, "November",
12, "December",
"None" ),TEXT(Fiscal_Year End__c)))

If this helps, Please mark it as best answer.

Thanks!!
This was selected as the best answer
AlizehSAlizehS
Hi @Ankaiah, I appreciate your help. This worked for me. Thanks a ton !