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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

[Newbie] setting Max value for standard dialogue field from extended general ledge setup

(0) ShareShare
ReportReport
Posted on by 60

Greetings,

I would like to take an input from the user which is a year and i want the max accepted value to be taken from the general ledger setup table.

I added the maximum integer field in the general ledger table field:

field(50102; MaxYearForCommissions; Integer)
        {
            Caption = 'Max Year For Commissions';
            DataClassification = ToBeClassified;
        }
 

and then proceeded by creating a field in the standard dialogue page where i want this integer to be added:

field(SelectedYear; SelectedYear)
            {
                ApplicationArea = All;
                Caption = 'SelectedYear';
                //add max value here
            }

Things I tried:

GenLedgSetup: Record "General Ledger Setup";
        MinimumValue: integer;
        MaximumValue: integer;

    trigger OnOpenPage()
    begin
        System.Clear(SelectedYear);
        // MaximumValue := GenLedgSetup.MaxYearForCommissions; (BC is crashing when running this code)
    end;

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,248 Super User 2026 Season 2 on at

    If I understood correct then you want to show the MaxYearForCommissions value of General Ledger Setup in the SelectedYear of the StandardDialogue page?

    If yes then

    trigger OnOpenPage()

       begin

           System.Clear(SelectedYear);

          GenLedgSetup.get();

          SelectedYear:= GenLedgSetup.MaxYearForCommissions;

       end;

  • Charbel Hleyhel Profile Picture
    60 on at

    Thank you for your answer but i think I misled you with my question.

    To rephrase it:

    I would like the user to populate the Selected Year field of the standard dialogue but I want to set a criteria where the max value the field can take is equal to the integer entered in the general ledger setup.

    Thank you!

    *edit:Grammar mistake.

  • Verified answer
    Mohana Yadav Profile Picture
    61,248 Super User 2026 Season 2 on at

                       trigger OnValidate()

                       begin

                           GenLedgSetup.get();

                          If SelectedYear > GenLedgSetup.MaxYearForCommissions then

                            Error('You have selected beyond the allowed year.');

                       end;

  • Charbel Hleyhel Profile Picture
    60 on at

    Thank you for your answer!

    Even though I thought about this but I thought there would be a more straight forward answer that I did not consider.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 572 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 331 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 330 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans