Fiscal calendar period dates and status

Fiscal calendar period dates and status

MCP · Azure DevOpsYour delivery board, readable by an agentMCP · DataverseOne consent, and the data layer opensMCP · Dynamics 365 F&OConnecting F&O to an agent Microsoft hasn’t documented
Financial calendars can be created and accessed from General ledger > Setup > Financial calendars.

Fiscal calendar periods status (Open, On hold and Closed) can be changed from General ledger > Setup > Ledger > button.












Following job can be used to  get Start and End date of current Fiscal year

static void fiscalCalendarDates(Args _args)
{
    PeriodStart     periodStartDate;
    PeriodEnd       periodEndDate;

    periodStartDate = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).StartDate;
    periodEndDate   = FiscalCalendarYear::findYearByCalendarDate(CompanyInfo::fiscalCalendarRecId(), systemDateGet()).EndDate;

    info(strFmt("%1", periodStartDate));
    info(strFmt("%1", periodEndDate));

    periodStartDate = FiscalCalendars::findFirstDayofYear(Ledger::find(Ledger::current()).FiscalCalendar, systemDateGet());
    periodEndDate   = FiscalCalendars::findLastDayofYear(Ledger::find(Ledger::current()).FiscalCalendar, systemDateGet());

    info(strFmt("%1", periodStartDate));
    info(strFmt("%1", periodEndDate));

}

Following job can be used to get the period status (Open, On hold and Closed)

static void checkFiscalCalendarPeriod(Args _args)
{
    TransDate               transDate = systemDateGet();
    RecId                   calendarRecId;
    FiscalCalendarPeriod    fiscalCalendarPeriod;

    calendarRecId = Ledger::fiscalCalendar(CompanyInfo::find().RecId);

    fiscalCalendarPeriod = FiscalCalendars::findPeriodByPeriodCodeDate(calendarRecId, transDate, FiscalPeriodType::Operating);


    if (transDate)
    {
        if (! fiscalCalendarPeriod)
        {
            checkFailed(strFmt("@SYS17614",date2StrUsr(transDate, DateFlags::FormatAll)));
        }

        if (fiscalCalendarPeriod.currentLedgerPeriodStatus() !=  FiscalPeriodStatus::Open)
        {
            checkFailed(strFmt("@SYS17615", date2StrUsr(transDate, DateFlags::FormatAll)));
        }
    }
}

Previous article← Dynamics AX tab in MS Project Client
Discussion

Ask a question or leave feedback

This is a review interaction. The WordPress version will store, thread and moderate comments.

Thanks — submitted for moderation in this review.
Search the whole site · Ctrl/⌘ + K