Search code examples
microsoft-dynamicsnavision

Dynamics NAV 2018 - Add column to page


I'm trying out Extensions 2.0 with Dynamics NAV 2018. I've managed to successfully add a table extension with two fields.

tableextension 50001 SalesShipExt extends "Sales Shipment Line"
{
    fields
    {
        // Add changes to table fields here
        field(50001;VehicleRegNo;Text[10])
        {
            trigger OnValidate();
            begin

            end;
        }
        field(50002;ShipmentNo;Text[10])
        {
            trigger OnValidate();
            begin

            end;
        }
    }

    var
        myInt : Integer;
}

My problem is now making these fields visible on pages. Below is what I have but I keep getting errors that VehicleRegNo does not exist in the current context. Why would this be the case?

pageextension 50002 PostedSalesShipExt extends "Posted Sales Shipment"
{
    layout
    {
        // Add changes to page layout here
        addlast(Content)
        {
            repeater(Lines)
            {
                field("Vehicle Registration No"; VehicleRegNo)
                {
                    trigger OnValidate();
                    begin
                    end;
                }
            }
        }
    }

    actions
    {
        // Add changes to page actions here
    }

    var
        myInt : Integer;
}

Solution

  • The issue is you have added the fields to the line table but are adding the fields to a page that is attached to the header table. If you use "Posted Sales Shpt. Subform" as your page it should find the fields.