Hey Everyone,
I'm struggling with a issue, and decided to share with u guys. I want to insert a new salesline automatically when the first line is inserted. I managed to insert with below code, but instead they switch place, so the line with below code takes first position, and first line takes second position etc.
SalesLine2.RESET; SalesLine2.SETRANGE("Document Type",Rec."Document Type"); SalesLine2.SETRANGE("Document No.",Rec."Document No."); IF SalesLine2.FIND('+') THEN NextLineNo := Rec."Line No." + 10000 ELSE NextLineNo := 10000; SalesLine2.INIT; SalesLine2.VALIDATE("Document Type", Rec."Document Type"); SalesLine2."Document No." := "Document No."; SalesLine2."Line No." := NextLineNo; SalesLine2.Type := SalesLine2.Type::Item; SalesLine2."No." := Item.exItem; SalesLine2.Quantity := Quantity; SalesLine2.Description := Item.Description; SalesLine2.INSERT;
I hope, i clearly explained my situation.
*This post is locked for comments