What is the last step of the posting routine?

redhotmustangredhotmustang Member Posts: 91
Hi there,

I was asked to place a message at the end of every posting routine for a series of documents (like Invoices and Credit Memos) stating the "Document No." that was used to post it to the "G/L Entry" table.
"This Invoice/CM was posted with the Document No. INV-001".

But I'm having a problem in achieving this.

The posting routine starts and shows the progress information. If there is an error in filling out the form, the routine stops and my message does not appear. That's fine.

The big problem emerged when errors occur after that. My message shows the "Document No." but then the error stops the entire process.

I'm trying and trying but I can't find the last step of the posting routine in order to place the C/AL code for that message at the very end of it all.

Can anybody help me?

Thanks in advance.

P.S.: I placed the code in the Codeunit 12 "Gen. Jnl.-Post Line".
Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)

Answers

  • willywilly Member Posts: 67
    Hi!

    Try putting your message in codeunit 80 - at the bottom of the onrun function
  • redhotmustangredhotmustang Member Posts: 91
    Thanks, I'll try to see if it works!

    EDIT: Nope, not working. I've posted a Sales Invoice and a Sales Credit Memo and that message does not appear.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
  • ssinglassingla Member Posts: 2,973
    Or in 81 just before commit
    CA Sandeep Singla
    http://ssdynamics.co.in
  • redhotmustangredhotmustang Member Posts: 91
    In Codeunit 81 it doesn't show.

    I'm studying this posting routine to see the big picture here.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
  • DenSterDenSter Member Posts: 8,304
    You don't put messages in the posting routines themselves. If you want to see a message, put it in the object that calls the posting routine.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    The none modification way is to just post and print to a PDF printer.

    The printed document will show the posted document number.
  • redhotmustangredhotmustang Member Posts: 91
    DenSter, I think you're right and that works fine.

    But the issue is that, when there's an error of somekind (like choosing a non existent bank account for the "Payment Method Code" field in the "Purchase Credit Memo") that information message (with the post "Document No.") stills shows up after the error message (when the process should stop right there), taking the user to think that even though there was an error the document was still posted.

    I need the information message to only show in the last step of the routine, if there are no errors.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
  • DenSterDenSter Member Posts: 8,304
    But the issue is that, when there's an error of somekind (like choosing a non existent bank account for the "Payment Method Code" field in the "Purchase Credit Memo") that information message (with the post "Document No.") stills shows up after the error message (when the process should stop right there), taking the user to think that even though there was an error the document was still posted.
    Then program your code to only display the message when the posting succeeds.

    Again, programming messages directly in the posting routines is a very bad development practice. The very reason for the Yes/No posting codeunits is to ensure that there are no messages in the posting routines themselves.
  • redhotmustangredhotmustang Member Posts: 91
    Yes yes, you're right.
    I was forgetting the basic, lol. Go to the table and check if it is posted, then show the message.
    Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)
Sign In or Register to comment.