[PO] PurchLine.Quantity Validation

sanjeev_baranwalsanjeev_baranwal Member Posts: 101
Hi,
When we enter the quantity in a PO then Outstanding Amount (LCY),Line Amount Excl. VAT,Amount Including Tax,Tax Base Amount,Amount To Vendor are updated as according to the updated Quantity Value. But in my condition in a PO with released status I am first Making the Status Open by Code modifying the Quantity and then again Setting the Status to Release in Code. Everythin is fine except the above mentioned fields are not getting updated. If I directly do this in form by then its is getting updated but not in Code. Can anyone please suggest me what may be the problem.

Comments

  • sanjeev_baranwalsanjeev_baranwal Member Posts: 101
    AnyOne here to help me on this issue.
  • DenSterDenSter Member Posts: 8,305
    Instead of:
    PurchaseLine.Quantity := SomeValue;
    
    you do this:
    PurchaseLine.VALIDATE(Quantity,SomeValue);
    
    The reason it works from the form is that from there is automatically runs the validation code, and from within code you have to specifically program it that way. The rule of thumb is that if you want to take advantage of NAV business logic, you program it just the way you would enter something manually, and you validate all fields. If you need to bypass the logic, then you use direct statements.
  • sanjeev_baranwalsanjeev_baranwal Member Posts: 101
    I have already did the same. thats why I have posted my Query to this forum.
  • DenSterDenSter Member Posts: 8,305
    Then you need to debug the issue and find out why it is not doing what you expect it to do. By using VALIDATE it executes the code in the OnValidate trigger, so there must be something in there that is doing something that you are not expecting.
Sign In or Register to comment.