Hello,
I'm having an issue that I cannot resolve and I was hoping someone who's had a similar issue can help me with a possible solution.
A customer needs to add automatically a line to a purchase order where line Type is of "G/L Account". The customer creates a new purchase order and then selects a vendor no. I have constructed a codeunit which inserts a line to the purchase order. But when the field "No." is validated I get an error informing that the purchase order vendor no. is missing. I understand that if I put my code in for example the function OnValidate, in both the form or the table, the actual modification of the field "Buy-from Vendor No." has not been made yet and therefore I get this error. The problem is where do I call my codeunit to be able to add a line which calls the validation function of the field "No." when "Buy-from Vendor No." has been changed but after the change has been saved?
I have tried to use COMMIT and to call my codeunits from all the triggers of the field "Buy-from Vendor No." in the form, and also the forms OnModify-function, and the table Purchase Header's Modify-function and the fields VALIDATE-function.
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Just a happy frood who knows where his towel is
Just create a dummy vendor (i.e. Order in Process) without setup
Then insert lines with your codes & when actual vendor will be selected in Buy-from Vendor No. lines get updated with new vendor No.
PurchSetup."Exchange Account (G/L)" = field added to setup table to it can changed in the future if need be. Don't like hard coding.
http://www.BiloBeauty.com
http://www.autismspeaks.org