AngeloAngelo Member Posts: 180
Hello Master,

In Nav 3.7, in Purchase Order and code behind Archive Document, :


When I want to use the codes above and I insert the codes above in Release Purchase Document(CU 415), amount in PO Archive show amout : 0. In real, amount = 40000 but when I release(with my modified codes), amount = 0 in PO archive.

The problem is Currform.update(false).....if I code in CU 415, Currform.update(false) can not be added only : ArchiveManagement.ArchivePurchDocument(Rec);.
So, What shoul I do to archive PO when release?


  • Options
    AlbertvhAlbertvh Member Posts: 516
    Hi Angelo
    What you could do is remove the code off the menu item ie take out the RunObject and Codeunit Release Purchase Document and put code into the OnPush trigger for the release of your purchase orders

    Set a variable to call the releasing codeunit
    then in the OnPush

  • Options
    kinekine Member Posts: 12,562

    where Rec is the Document you want to archive is all what you need.

    CurrForm.UPDATE(False); is only refresh of the atual form - if you want archive the document in codeunit, you do not need that, because after the codeunit end, form is refreshed... (I think, but I am not sure)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    DenSterDenSter Member Posts: 8,304
    I think adding the call to the archive coduenit to the release function is the right thing to do.

    The term CurrForm refers to "The Current Form", and can only be used from a form object, which is why it causes a compile error when you use it in a codeunit.

    The form should automatically refresh, but that doesn't always happen for some weird reason. Adding the call to the codeunit in C/AL code instead of in the button properties will allow you to make the form refresh on your terms.
Sign In or Register to comment.