For default values you only have one reference date formula, TODAY()
, so there isn't a direct route to determine what your current fiscal year settings are. However, you can create the illusion of one by hardcoding the start are end of you're fiscal years. It'll fail eventually, but then you'll probably have a salesforce dev at your disposal who can write the trigger for you.
So if you have the following fiscal years
- FY2014: 4/1/14 to 3/31/15
- FY2015: 4/1/15 to 3/31/16
- FY2016: 4/1/16 to 3/31/17
You could use this formula
IF(TODAY() < DATE(2015,4,1), DATE(2014,4,1),
IF(TODAY() < DATE(2016,4,1), DATE(2015,4,1),
IF(TODAY() < DATE(2017,4,1), DATE(2016,4,1),
...
)
)
)
TEXT(MONTH(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(DAY(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(YEAR(TODAY() - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ ' to ' +
TEXT(MONTH((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(DAY((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
+ '/' +
TEXT(YEAR((TODAY() + 7) - MOD(TODAY() - DATE(1900, 1, 7), 7)))
which on today's date (02/14/2013), would return:
2/10/2013 to 2/17/2013
I utilized the formula provided in this post to get the current offset on the day of the week. Using that, I just subtracted from today. Unfortunately, you wanted the date formatted outside of the base format of a date which would be 2013-02-14
. To take account for that, I had to do some manipulation and just pull in the month, day, and year of the date.
Best Answer
Nothing simple exists that I'm aware of.
However, check out the useful advanced formulae page: http://login.salesforce.com/help/doc/en/useful_advanced_formulas.htm
In particular, this has a formula for calculating the day of the week as a number (0 = Sunday...6=Sunday).
The above will give you Entry Date's day of the week. To get Sunday, you should be able to subtract the result of that from the Entry Date
Though you would need to add some complexity to this to handle the start of a month/year.
Edit:As @TomLogic points out below, you may be able to avoid using the DATE function and having to add complexity to handle start of month/year issues by subtracting the result of the Mod operation from the Date directly (though I've not yet tested it!)