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
fsiddiq3fsiddiq3 

Month and Year Function

Hello,

 

   I am trying to create a workflow with a field update that basically combines the month of the current date and the year of the current date. I have the field set up as a number, and this is the formula I am using. For some reason I am getting an error message. Below is the formula, what am I doing wrong? Any help is appreciated, thanks!

 

MONTH(TODAY()) & "" & YEAR(TODAY())

Best Answer chosen by Admin (Salesforce Developers) 
fsiddiq3fsiddiq3
That worked great! Thanks for your help!!

All Answers

ExecbizExecbiz

 The problem is that you're trying to perform the & operation, which operates on text, on variables that are numbers.  To fix this, the easiest way would be to convert each aspect to text:

 

TEXT(MONTH(TODAY())) & "" & TEXT(YEAR(TODAY()))

 

The formula will output text instead of number, but for your purposes (you probably wouldn't sort by this value if you're putting the month first) this should work fine.

fsiddiq3fsiddiq3
That worked great! Thanks for your help!!
This was selected as the best answer