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

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

Answers

  • SanderDkSanderDk Member Posts: 497
    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, use forum instead, perhaps other people have the same question, or better answers.
  • RubendarRubendar Member Posts: 7
    . Per sales Order
  • pradipradi Member Posts: 15
    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 Member Posts: 7
    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 Member Posts: 19
    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.