i need to restrict the items in the SalesLine . One customer should not order more than three items

RubendarRubendar Posts: 7Member
How should i do it can anyone tell .

Answers

  • SanderDkSanderDk Posts: 320Member
    Per sales order or in total?

    Are there a specific reason that you need to limit the number of item instead of the amount ?
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • RubendarRubendar Posts: 7Member
    . Per sales Order
  • pradipradi BrusselsPosts: 15Member
    On release of the sales order you can write a new function and call it, to check whether more than three items are added in the sales line and pop up a error.
  • RubendarRubendar Posts: 7Member
    SalesLine2.Setrange("Document Type", SalesHeader."Document Type");
    SalesLine2.Setrange("Document No.", SalesHeader."No.");
    SalesLine2.Setfilter("No.",'<>%1,'');

    if SalesLine2.Count > 3 Then
    ERROR('You can only insert 3 lines into an Order');

    this is my coding
  • gycsiakgycsiak Posts: 11Member
    In your case I would also filter for SalesLine2.SETRANGE(Type,Type::Item); as if there would be any other type of lines on the sales order (Item (Charge) or G/L Account for any discount, etc.), then you order would surely have at most 3 lines, but not 3 item lines.
Sign In or Register to comment.