Wednesday, June 6, 2018

Extensions and Edit and Display methods declaration in D365

Just a short note for my current PU.

Display methods work well as instance methods from table extensions. As to edit-methods, we still need to declare them as static.

final class avrProjProposalJourTable_ProjInvReport_Extension

 static public server edit avrProjInvReportFmtDescWithBr avrEditInvReportFormatWithBR(ProjProposalJour _this, boolean _set, PrintMgmtReportFormatDescription  _newReportFormat)
        PrintMgmtReportFormatDescription    newReportFormat = _newReportFormat;
        PrintMgmtReportFormatDescription    reportFormat;

        reportFormat = ProjInvoicePrintMgmt::avrGetReportFormatWithBR(_this);
        if (_set)
            if (_this.RecId && newReportFormat && newReportFormat != reportFormat)
                ProjInvoicePrintMgmt::avrCreateOrUpdateInvoiceWithBRPrintSettings(_this, PrintMgmtNodeType::ProjProposalJour, newReportFormat);
                reportFormat = newReportFormat;
        return reportFormat;

Do not forget to pass the table buffer as the first argument.

More detail can be found in Vania's article about news in PU11.

No comments: