web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Error when updating to version 23.0

(1) ShareShare
ReportReport
Posted on by 39
I have a report extension for standard - sales invoice where I added some fields and changed the layout in the Report layout selection 
It gives the following error when trying to update to version 23.0 
Failure while emitting metadata for object:'ReportExtension SalesInvoiceExt' (Object reference not set to an instance of an object.) Object reference not set to an instance of an object.
 
I checked the code and the layout and they seem fine.
 
Does anyone know what might be the problem here?

This is the code for the Report extension
reportextension 73101 SalesInvoiceExt extends /Standard Sales - Invoice/
{
    dataset
    {
        add(Header)
        {
            column(ShowLotExp; ShowLotExp) { }
            column(CustBalance; CustBalance) { }
            column(ShowDisc; ShowDisc) { }
        }
        add(Line)
        {
            column(Quantity; Quantity) { }
            column(TotalQtt; TotalQtt) { }

        }
        addafter(line)
        {
            dataitem(/Value Entry/; /Value Entry/)
            {
                DataItemLink = /Document No./ = field(/No./);
                column(Document_No_; /Document No./) { }
                column(Entry_No_; /Entry No./) { }
                column(Invoiced_Quantity; /Invoiced Quantity/) { }
                column(Item_No_; /Item No./) { }
                // column(LotNo; ILE./Lot No./) { }
                // column(Expiry; ILE./Expiration Date/) { }
                dataitem(/Item Ledger Entry/; /Item Ledger Entry/)
                {
                    DataItemLink = /Entry No./ = field(/Item Ledger Entry No./);
                    column(Lot_No_; /Lot No./) { }
                    column(Package_No_; /Package No./) { }
                    column(Expiration_Date; /Expiration Date/) { }
                }
            }
        }
        modify(Line)
        {
            trigger OnAfterAfterGetRecord()
            var
                // InL: integer;
                // Tx60a30LottoInLN: code[50];
                RcValueEntryRel: record /Value Entry Relation/;
                RcValueEntry: record /Value Entry/;
                RcItemLedgerEntry: record /Item Ledger Entry/;
            begin
                TotalQtt += Line.Quantity;
                if Line.Type = line.Type::/ / then
                    CurrReport.Skip();
                RcValueEntryRel.SETRANGE(/Source RowId/, FnRowID1);
                IF RcValueEntryRel.FIND('-') THEN BEGIN
                    REPEAT
                        IF RcValueEntry.GET(RcValueEntryRel./Value Entry No./) THEN
                            IF RcItemLedgerEntry.GET(RcValueEntry./Item Ledger Entry No./) THEN BEGIN
                                // InL := InL + 1;
                                LotNo := RcItemLedgerEntry./Lot No./;
                                Expiry := RcItemLedgerEntry./Expiration Date/;
                                LotQuantity := RcItemLedgerEntry.Quantity;
                                LotItemNo := RcItemLedgerEntry./Item No./;
                                LotEntry := RcItemLedgerEntry./Entry No./;
                            END;
                    UNTIL RcValueEntryRel.NEXT <= 0;
                END;
            end;
        }
        modify(Header)
        {
            trigger OnAfterAfterGetRecord()
            var
            begin
                CustBalance := 0;
                CusLedgEntry.SetRange(/Customer No./, Header./Sell-to Customer No./);
                CusLedgEntry.SetRange(Open, true);
                if CusLedgEntry.FindFirst() then
                    repeat
                        CusLedgEntry.CalcFields(/Remaining Amount/);
                        case CusLedgEntry./Currency Code/ of
                            '':
                                begin
                                    CurrExchRate.SetRange(/Currency Code/, 'USD');
                                    CurrExchRate.SetRange(/Starting Date/, 0D, CusLedgEntry./Posting Date/);
                                    if CurrExchRate.FindLast() then begin
                                        CustBalance += CusLedgEntry./Remaining Amount/ / CurrExchRate./Relational Exch. Rate Amount/;
                                    end;
                                end;
                            'USD':
                                begin
                                    CustBalance += CusLedgEntry./Remaining Amount/;
                                end;
                            else begin
                                USDCurrExchRate.SetRange(/Currency Code/, 'USD');
                                USDCurrExchRate.SetRange(/Starting Date/, 0D, CusLedgEntry./Posting Date/);
                                if USDCurrExchRate.FindLast() then;
                                CurrExchRate.SetRange(/Currency Code/, CusLedgEntry./Currency Code/);
                                CurrExchRate.SetRange(/Starting Date/, 0D, CusLedgEntry./Posting Date/);
                                if CusLedgEntry.FindLast() then;
                                CustBalance += (CusLedgEntry./Remaining Amount/ * CurrExchRate./Relational Exch. Rate Amount/) / USDCurrExchRate./Relational Exch. Rate Amount/;
                            end;
                        end;
                    until CusLedgEntry.next = 0;
                if Customer.get(Header./Sell-to Customer No./) then;
                if Customer./Xee_Show Discount on Invoice/ then
                    ShowDisc := true
                else
                    ShowDisc := false;
            end;
        }
    }
    requestpage
    {
        layout
        {
            addafter(HideDescription)
            {
                field(/Hide Lot/Expiry/; ShowLotExp)
                {
                    ApplicationArea = all;
                }
            }
        }
    }

    local procedure FnRowID1(): Text[250]
    var
    begin
        EXIT(ItemTrackingMgt.ComposeRowID(DATABASE::/Sales Invoice Line/, 0, Line./Document No./, '', 0, Line./Line No./));
    end;
    var
        // itemtrackmgt: codeunit 73100;
        LotEntry: integer;
        LotItemNo: code[30];
        LotQuantity: integer;
        LotNo: code[50];
        Expiry: date;
        ShowLotExp: Boolean;
        CustBalance: Decimal;
        CurrExchRate: Record /Currency Exchange Rate/;
        Customer: Record Customer;
        USDCurrExchRate: Record /Currency Exchange Rate/;
        CusLedgEntry: Record /Cust. Ledger Entry/;
        ShowDisc: Boolean;
        ItemTrackingMgt: Codeunit /Item Tracking Management/;
        TotalQtt: Decimal;
}
 
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
    Error when updating to version 23.0
    Hi,
     
    I think follow these steps :
    1. delete your extension from project 
    2. build your project
    3. perform the upgrade
    4. re-create your report extension (fix problems if they exist)
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    Error when updating to version 23.0
    Hi,
    In My case its working fine, Please delete any custom layout if you have created, publish the app again and try.
     
    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,421

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,878 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,645 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans