[SalesForce] Default a Date field to FISCAL YEAR start/end when a record is created without using Apex triggers

I need to set a Date field on an object to the organization's Fiscal Year's Start Date. This could be a formula field, but ideally it would be just a Date field so that the value could be modified if needed.

I could do this using an Apex trigger, but this object is being used in an Analytic Snapshot, so the object cannot have an after insert trigger.

Is there some sort of hidden DATE() formula function value that I could use to pull out the FISCAL YEAR's start date in the field's Default value function?

Best Answer

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),
            ...
        )
    )
)