Hi All
Creating my first extension. One of the functions is to add a line item for freight based on the ship method.
When I'm using the UI, I select line type "Item" and enter item No 'FLOC' (for example). when I tab out of that field it will lookup the item desc, , posting groups, customer special pricing.
this is my code:
SalesLine.Init;
SalesLine."Document Type" := rec."Document Type";
SalesLine."Document No." := rec."No.";
SalesLine.Type := SalesLine.Type::Item;
SalesLine."No." := 'FLOC';
SalesLine.Quantity := 1;
SalesLine.Insert()
It adds the item, but doesn't lookup the description, etc.
What do I need to do to make it behave like the UI?
Thanks
Mark
Answers
Through the UI the OnValidate is always triggered, but in code you can avoid it so you can do everything yourself so you have to actually call it yourself.
Instead of SalesLine."No." := 'FLOC'; you should use SalesLine.Validate("No.", 'FLOC');