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

Announcements

Community site session details

Community site session details

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

How I can prevent inserting duplicate values in External Document Number on page "Posted Sales Inv. - Update"??

(0) ShareShare
ReportReport
Posted on by 37

Hello Experts,

I need someone to help me with how I can prevent inserting duplicate values in external document numbers on the page "Posted Sales Inv. - Update".

6013.Screenshot-_2800_124_2900_.png

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,139 Super User 2026 Season 1 on at

    You can start with learning AL from the below link

    learn.microsoft.com/.../devenv-get-started

    You have to write code on OnValidate trigger of the External Document No. field and check if that value is present in Sales Invoice Header's external document no. field except the current document.

    Maybe you can start implementing the logic and ask us if you are facing any issues.

  • Lama Profile Picture
    37 on at

    Thanks for your help, Mr. Mohana.

    I solved this problem by  "OnValidate trigger " as you advised me.

  • Verified answer
    YUN ZHU Profile Picture
    97,619 Super User 2026 Season 1 on at

    Hi, I checked this page, there is no "External Document No." field in the standard, did you customize it?

    When customizing this page, in addition to adding new fields, there are still points that need attention. I hope the following information can give you some tips.

    https://yzhums.com/24923/

    pastedimage1676596793526v1.png

    For validation checks, you can look at the code below.

    pageextension 50116 MyExtension extends "Posted Sales Inv. - Update"
    {
        layout
        {
            addafter("No.")
            {
                field("External Document No."; Rec."External Document No.")
                {
                    ApplicationArea = All;
    
                    trigger OnValidate()
                    var
                        SalesInvHeader: Record "Sales Invoice Header";
                    begin
                        SalesInvHeader.Reset();
                        SalesInvHeader.SetRange("External Document No.",Rec."External Document No.");
                        if not SalesInvHeader.IsEmpty then
                        Error('Duplicate values in External Document Number');
                    end;
                }
            }
        }
    }

    Thanks

    ZHU

  • Lama Profile Picture
    37 on at

    Your answer is always short and useful. Thank you for your support Mr.ZHU

    I benefited greatly from the link you provided 

    https://yzhums.com/24923/

  • Suggested answer
    Mohana Yadav Profile Picture
    61,139 Super User 2026 Season 1 on at

    try this

    https://youtu.be/NwYCMDqW-Bk

  • Lama Profile Picture
    37 on at

    Thank you very much for your time and your help Mr. Mohana.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,373 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,210 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 1,188 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans