Skip to main content

Notifications

Community site session details

Community site session details

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

Unit measure mandatory in purchase line in AL

(0) ShareShare
ReportReport
Posted on by

Dear All.

Am trying to make unit of measure mandatory in the purchase line but it's not working. Below is my AL code.

Modify("Unit of Measure")
        {
            trigger OnAfterValidate()
            begin
                //If (Rec."Unit of Measure" = '') then
                TESTFIELD("Unit of Measure");
                //Error('The Unit of Measure cannot be empty.');

            end;
        }
  • Romryan Profile Picture
    on at
    RE: Unit measure mandatory in purchase line in AL

    Any suggestion?

  • Romryan Profile Picture
    on at
    RE: Unit measure mandatory in purchase line in AL

    Ramy,

    Below is my code and its not working.

    Modify("Unit of Measure")

           {

               trigger OnAfterValidate()

               begin

                   //If (Rec."Unit of Measure" = '') then

                   TESTFIELD("Unit of Measure");

                   //Error('The Unit of Measure cannot be empty.');

               end;

           }

  • Suggested answer
    raelhefn Profile Picture
    on at
    RE: Unit measure mandatory in purchase line in AL

    Missing AL code but you can take a look at this post it can assist in your case.

    community.dynamics.com/.../making-fields-mandatory

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 944

#2
YUN ZHU Profile Picture

YUN ZHU 843 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 602

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans