17 May 2021

How to override lookup form control methods using extensions / events in d365FO

 How to stop standard lookup and override the new lookup method.

FormControlCancelableSuperEventArgs formControlCancelSuper = e as FormControlCancelableSuperEventArgs;

        SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProjCategory), sender);

      

        sysTableLookup.parmQuery(query);

        sysTableLookup.performFormLookup();

        formControlCancelSuper.CancelSuperCall();

11 May 2021

X++ code to check Fiscal calendar period in AX 2012 and D365FO

X++ code to check Fiscal calendar period in AX 2012 and D365FO 

used to get the period status (Open, On hold and Closed)

  public static boolean checkFiscalCalendarPeriod(TransDate _transDate)

    {

        RecId calendarRecId;

        FiscalCalendarPeriod fiscalCalendarPeriod;


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


        fiscalCalendarPeriod = FiscalCalendarPeriod::findPeriodByCalendarDate(calendarRecId, _transDate, FiscalPeriodType::Operating);


        if (_transDate)

        {

            if (!fiscalCalendarPeriod)

            {

                return checkFailed(strFmt("@SYS17614",date2StrUsr(_transDate, DateFlags::FormatAll)));

            }


            if (fiscalCalendarPeriod.currentLedgerPeriodStatus() != FiscalPeriodStatus::Open)

            {

                return checkFailed(strFmt("@SYS17615", date2StrUsr(_transDate, DateFlags::FormatAll)));

            }

        }


        return true;

    }

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...