web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    60,993 Super User 2025 Season 2 on at
    RE: [Newbie] setting Max value for standard dialogue field from extended general ledge setup

    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
    RE: [Newbie] setting Max value for standard dialogue field from extended general ledge setup

    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
    60,993 Super User 2025 Season 2 on at
    RE: [Newbie] setting Max value for standard dialogue field from extended general ledge setup

                       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
    RE: [Newbie] setting Max value for standard dialogue field from extended general ledge setup

    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

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 3,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans