Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

ID Range Problem for Aggregate Extension

Posted on by 60

Dear all,

i have created a table extension for the purchase inv line aggregate. Here I simply return more standard table fields (63 64).

This works fine in my sandbox. When I now use the application in a tenant Saas BC the extension validation fails with:

(6,19): error PTE0002: Field 'Receipt No.' has an ID of [63. It must be between within the range '[50000..99999'.

But if i change the field id to the range 50000... the field is not picked up correctly anymore from the original table.

How can I map the table field id 63 to my needed range 50000..99999?

Thanks in advance.

tableextension 50120 "EX Purch. Inv. Line Aggregate" extends "Purch. Inv. Line Aggregate"
{
    fields
    {

        field(63; "Receipt No."; Code[20])
        {
            Caption = 'Receipt No.';
            Editable = false;
        }
        field(64; "Receipt Line No."; Integer)
        {
            Caption = 'Receipt Line No.';
            Editable = false;
        }
        field(65; "Order No."; Code[20])
        {
            Caption = 'Order No.';
        }
        field(66; "Order Line No."; Integer)
        {
            Caption = 'Order Line No.';
        }
        field(5791; "Promised Receipt Date"; Date)
        {
            AccessByPermission = TableData "Order Promising Line" = R;
            Caption = 'Promised Receipt Date';
        }
    }
}

Categories:
  • SvenB Profile Picture
    SvenB 60 on at
    RE: ID Range Problem for Aggregate Extension

    I have not figured out how to make this work with the aggregate page and therefore moved away from extending the V2 pages. Now I am using the standard pages and it works fine.

  • SvenB Profile Picture
    SvenB 60 on at
    RE: ID Range Problem for Aggregate Extension

    Hi ZHU YUN,

    thanks for the help. My problem ist the following: As soon as I change the field number from 63 to the range 50000-99999 I do not receive the actual entry from the Purch. Inv. Line table.

    So in below example I return both fields in my API Page, but only get a result for the first field (with ID 63) but not for my own custom field (with ID 65063).

    How do I have to change the table extension field, to return the Receipt No. from the Purch. Inv. Line in the custom field within the correct range?

    Thanks

    Bildschirmfoto-2022_2D00_01_2D00_25-um-10.53.22.png

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 69,864 Super User 2024 Season 2 on at
    RE: ID Range Problem for Aggregate Extension

    Hi, I'm not clear about your purpose, as Igne said, if you want to modify a field, please use Modify, if you want to add a new field, please use the range of 50000~99999. Because this is a TableExtension not a new table, 0-49,999 is assigned to Business Central base app functionality and must not be used in extensions or customizations.

    Then as you mentioned, the field '"Receipt No."' is not found in table 5478 "Purch. Inv. Line Aggregate", you should use the range of 50000~99999 to add new fields, instead of the standard ID fields, which may be different from NAV.

    pastedimage1643072631117v1.png

    Hope this will help.

    Thanks.

    ZHU

  • SvenB Profile Picture
    SvenB 60 on at
    RE: ID Range Problem for Aggregate Extension

    Dear Inge,

    thanks for the help!

    I now added the "modify" statement. But in the modify input the correct field "Receipt No." is not recognized, as it is not yet defined on the table "Purch. Inv. Line Aggregate", but only on the "Purch.Inv. Line" Table.

    E.g.

    modify( "Receipt No.)

    {}

    -> The field '"Receipt No."' is not found in the target 'Purch. Inv. Line Aggregate'

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: ID Range Problem for Aggregate Extension

    If you want to modify the behavior of an existing field you need to add a modify{yourfield} section in your code. If you do not do that AL will think you want to add a new field in the table.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans