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

I need to do External Document No. as mandatory.

(0) ShareShare
ReportReport
Posted on by 132

Here when we going to insert lines in sales order without giving the value to the External Document No. then the External Document No. must show the error.

SalesLinesInsertion.PNG

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    131 on at
    RE: I need to do External Document No. as mandatory.

    Fairly sure testfield doesn’t require that as the if statement because it is testing for a value - which in this case has to be any text value.

    Could you not use standard setup here and save on development effort?

    1950BB32_2D00_2C7E_2D00_48DD_2D00_A2D8_2D00_8DED73258FEB.jpeg

  • Dyavari Sandeep Yadav Profile Picture
    132 on at
    RE: I need to do External Document No. as mandatory.

    Thanks for the reply. but it is only useful for the showing mandatory symbol. But my requirement is not that one. please check my description.

  • Verified answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,275 Super User 2025 Season 2 on at
    RE: I need to do External Document No. as mandatory.

    Rather than putting it on page extension, why not put it on Codeunit 414 - Release Sales Document ?

    You can subscribe to event OnBeforeReleaseSalesDoc and put the TestField there.

    Yes, users can insert the line, but they will not be able to post or release the order without filling in External Document No.

  • Suggested answer
    Dallefeld Profile Picture
    211 User Group Leader on at
    RE: I need to do External Document No. as mandatory.

    Agree with Teddy H.

    Trying to force data entry errors are hard, if the user does not access the field, there is no test that happens. Release is the best place to test for errors.

    If your reason for the change is that you want the external document number on the lines, then your code at Release could validate that you have an external document number and if the lines are blank, it can populate the value.

  • Verified answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at
    RE: I need to do External Document No. as mandatory.

    Agree with Teddy H.

    Additionally if you have to write this code (assuming you have to) then you should write on table OnBeforeInsert event.

  • Verified answer
    YUN ZHU Profile Picture
    95,307 Super User 2025 Season 2 on at
    RE: I need to do External Document No. as mandatory.

    Hi, For External Document No., please use the settings suggested by Josh. In the BC Demo database, Purchase Document is automatically enabled this, but for Sales Document, it is not enabled by default, so you may not notice it.

    For the customization of field mandatory, I hope the link below can give you some new inspiration.

    https://yzhums.com/4940/

    Thanks.

    ZHU

  • Verified answer
    tanya07 Profile Picture
    1,638 on at
    RE: I need to do External Document No. as mandatory.

    Hi,

    To top Teddy's reply, Please follow the same as below -

     [EventSubscriber(ObjectType::Codeunit, 414, 'OnBeforeReleaseSalesDoc', '', false, false)]
        local procedure MyProcedure(var SalesHeader: Record "Sales Header")

        begin

            SalesHeader.TestField(ExtDocNo);

        end;
    Thanks,
    Tanya Kharbanda
    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has a verified answer.

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