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

Announcements

No record found.

News and Announcements icon
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,204 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
    99,324 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,204 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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,823 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,011 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 628 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans