Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Error when updating to version 23.0

(1) ShareShare
ReportReport
Posted on by 29
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;
}
 
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,085 Super User 2024 Season 1 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.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 13,589 Super User 2025 Season 1 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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans