X++ code to check Fiscal calendar period in D365FO
X++
code to check Fiscal calendar period in D365FO 
public static boolean findFiscalCalendarPeriod(TransDate _date)
{
        RecId
calendarRecId;
       
FiscalCalendarPeriod fiscalCalendarPeriod;
        calendarRecId
= Ledger::fiscalCalendar(CompanyInfo::find().RecId);
       
fiscalCalendarPeriod =
FiscalCalendarPeriod::findPeriodByCalendarDate(calendarRecId, _date,
FiscalPeriodType::Operating);
{
            if
(!fiscalCalendarPeriod)
            {
                return
checkFailed(strFmt("@SYS17614",date2StrUsr(_date,DateFlags::FormatAll)));
            }
            if
(fiscalCalendarPeriod.currentLedgerPeriodStatus() != FiscalPeriodStatus::Open)
            {
return checkFailed(strFmt("@SYS17615", date2StrUsr(_date,DateFlags::FormatAll)));
            }
return true;
    }
- Get link
- X
- Other Apps
Comments
Post a Comment