Skip to main content
Microsoft Dynamics NAV forum
Answered

Block double entry of item number in the sales line

editSubscribe (0) ShareShare
ReportReport
Posted on by 5

Am  new in navision development I want to block a user from entering two same item number in the sales line this is because the user can inserts different quantities in the two lines in the same order number and two same item numbers want to have only one item number in the sales line not repeating the items number in the lines.Am using navision 2015.

  • luapolemunges Profile Picture
    luapolemunges 5 on at
    RE: Block double entry of item number in the sales line

    Hi Binesh,

    It worked as I wanted thanks alot

  • Verified answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Block double entry of item number in the sales line

    Hello luapolemunges,

    Create a function in codeunit, subscribe this function and write the below code or you can write this code in OnValidate - No.  field on sales Line Table

    //SalesLine is a record variable of sales line Table 37

    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type", Rec."Document Type");
    SalesLine.SETRANGE("Document No.", Rec."Document No.");
    SalesLine.SETRANGE(Type, SalesLine.Type::Item);
    SalesLine.SETRANGE("No.", Rec."No.");
    IF SalesLine.FINDFIRST THEN
     ERROR('%1 item already exist in this order!', Rec."No.");

    for reference see attachments.

    1667.2.png

    1667.2.png

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,066 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,585 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans