I am trying to expose fields that are not exposed in the OOB API in Business Central. Specifically the ItemLedgerEntry. I can create a custom page and expose it as a custom API, and create the table in the Dataverse, but I get OData errors when reading data.
I cannot think of another approach as I don't need a custom table I need a built-in table, just the default API does not expose the Lot No.
The AL source is posted below.
page 50101 ItemLedgerEntryPage
{
PageType = API;
APIVersion = 'v2.0';
APIPublisher = 'My Company';
APIGroup = 'MyCompany_API';
Caption = 'Item Ledger Entry With Lot';
EntityName = 'itemLedgerEntryWithLot';
EntitySetName = 'ItemLedgerEntryWithLot';
ODataKeyFields = SystemId;
SourceTable = "Item Ledger Entry";
DelayedInsert = true;
InsertAllowed = true;
DeleteAllowed = false;
ModifyAllowed = false;
layout
{
area(Content)
{
repeater(General)
{
field(id; rec.SystemId)
{
ApplicationArea = All;
Editable = false;
}
field(itemNo; Rec."Item No.")
{
ApplicationArea = All;
}
field(description; Rec.Description)
{
ApplicationArea = All;
}
field(lotNo; Rec."Lot No.")
{
ApplicationArea = All;
}
field(qty; Rec.Quantity)
{
ApplicationArea = All;
}
field(cost; Rec."Cost Amount (Actual)")
{
ApplicationArea = All;
}
field(entryType; Rec."Entry Type")
{
ApplicationArea = All;
}
field(documnetNo; Rec."Document No.") { }
field(documentType; Rec."Document Type") { }
field(entryNo; Rec."Entry No.") { }
field(salesAmount; Rec."Sales Amount (Actual)") { }
field(sourceNo; Rec."Source No.") { }
field(sourceType; Rec."Source Type") { }
field(jobNo; Rec."Job No.") { }
}
}
}
}