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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

AL List Page Not Letting Me Enter More Than One Record

(0) ShareShare
ReportReport
Posted on by 3,510

Hi:

Below in italics is my AL code for a test List Page that I'm creating in my Sandbox.

The page "works", except for one thing.  It will not let me enter more than one record into the page.

Immediately upon trying to enter the second record by filling in the first field, Business Central gives me the "F5" error telling me to refresh.

Why is that, and how can I fix this?

Thanks!

John

page 50112 "Playlist Item Rate Test"
{
    PageType = List;
    ApplicationArea = Basic;
    UsageCategory = Lists;
    SourceTable = "Playlist Item Rate Test";

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field("Description"; "Description") { ApplicationArea = Basic; }
                field("Item No."; "Item No.") { ApplicationArea = Basic; }
                field("Rate Amount"; "Rate Amount") { ApplicationArea = Basic; }
                field("Test"; "Test") { ApplicationArea = Basic; }

            }
        }
    }
}
I have the same question (0)
  • srttel Profile Picture
    on at

    The page seems to work fine with a very simple sourcetable in BC 19 sandbox

    /// <summary>

    /// Table PlaylistItemRateTable (ID 50100).

    /// </summary>

    table 50100 PlaylistItemRateTable

    {

       Caption = 'PlaylistItemRateTable';

       DataClassification = ToBeClassified;

       fields

       {

           field(1; ItemNo; Integer)

           {

               Caption = 'Item No';

               DataClassification = ToBeClassified;

           }

           field(2; Description; Text[100])

           {

               Caption = 'Description';

               DataClassification = ToBeClassified;

           }

           field(3; RateAmount; Integer)

           {

               Caption = 'Rate Amount';

               DataClassification = ToBeClassified;

           }

           field(4; Test; Text[250])

           {

               Caption = 'Test';

               DataClassification = ToBeClassified;

           }

       }

       keys

       {

           key(PK; ItemNo)

           {

               Clustered = true;

           }

       }

    }

    I recommend to check the underlaying table and use the debugger to check where it stops.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    have you checked the primary key of your table?

  • john.ellis Profile Picture
    3,510 on at

    Here is my table, in case it helps to find the solution:

    table 50111 "Playlist Item Rate Test"

    {

       fields

       {

           field(1; "Source Type"; Option) { OptionMembers = Vendor,Customer; }

           field(2; "Source No."; Code[20])

           {

               TableRelation = IF ("Source Type" = const(Vendor)) Vendor."No."

               else

               IF ("Source Type" = const(Customer)) Customer."No.";

           }

           field(30; "Item No."; Code[20]) { }

           field(40; "Description"; Text[50]) { }

           field(50; "Start Time"; Time) { }

           field(60; "End Time"; Time) { }

           field(70; "Rate Amount"; Decimal) { }

           field(80; "Publisher Code"; Code[10]) { }

           field(90; "Test"; Text[20]) { }

       }

    }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You don't have defined a key on this table, so every record that you insert takes the first field as primary key (always set as Vendor) and so the second record gives you an error.

    You need to define a correct primary key in your table.

  • john.ellis Profile Picture
    3,510 on at

    Thanks!  If I add the clause below at the end, will that work or will I get a syntax error in Visual Studio Code to troubleshoot?

       keys

       {

           key(PK; "Item No.")

           {

           }

       }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Add it before the last } and it will work.

  • john.ellis Profile Picture
    3,510 on at

    Nope.  Technically, there was still a problem.

    Visual Studio Code will not me specify a primary key other than "Source Type".  

    After inserting the "keys" syntax above with "Item No." as the primary key and trying to publish, Visual Studio Code gave me an error basically saying that I could not recreate the primary key in a table.

    I then tried to delete and recreate the same table and use the keys syntax above with "Item No." as the primary key.  Visual Studio Code told me that I could not delete a table unless it's temporary.

    So, I begrudgingly set the primary key as "Source Type" using the keys syntax above.  But, when I went to the page in Business Central, I got the same error that I mentioned at the beginning of this posting.

    I had to create a new but similar table using a different name and ID.

    Next, I deleted and recreated my page in Visual Studio Code with the same syntax but with a different ID and "told" the page to use the "new" table.

    After publishing, I was able to add new records to the page in Business Central.

    I suppose that the moral of the story is to always explicitly specify the primary upon creating a table.  Wow!

    Thanks!

    John

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You can simply add schemaUpdateMode: recreate in your launch.json file (if you’re on sandbox) and this will cause a recreation of the database schema (your table structure will change).

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 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans