1

We have a Salesforce org where they are using a custom fiscal year. The following results in a correct week number, but a null PeriodLabel:

    select Id, Number, PeriodLabel from Period

When going to setup > Company Profile > Fiscal Year > 2016

I am able to see the week number (24) and the Period is 6 for today's date (6/10/2016.)

How do I access the Period via Apex? Are there multiple queries or relationships I can use to access this? When I try to soql on it directly I get the following error:

    SELECT FISCAL_YEAR(CloseDate) fy FROM Case WHERE Id = '500f00000063b2sAAA' GROUP BY FISCAL_YEAR(CloseDate)

"Fiscal date calculations are not allowed when the custom fiscal year preference is enabled"

1 Answer 1

1

Per the Force.com SOQL and SOSL reference on Date Functions, FiscalMonth(), FiscalQuarter(), and FiscalYear() are not supported if your organization has custom fiscal years enabled. See "Fiscal Years" in the Salesforce Help.

I would suggest you consider trying to create some kind of conversion formula based on week of the year or something along those lines. It's not going to be simple as there are many things in your org that have been impacted by converting to a custom fiscal year as described in the Help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .