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...
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;
        }
I have the same question (0)
  • Suggested answer
    raelhefn Profile Picture
    on at

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

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

  • Romryan Profile Picture
    on at

    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;

           }

  • Romryan Profile Picture
    on at

    Any suggestion?

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,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans