Hi, I'm performing some post invoice posting activities and having some issues.
The way I'm doing it is by attaching an post type event handler on SalesFormLetter_Invoice.afterOperationBody() where I basically do:
SalesFormLetter_Invoice salesFormLetter_Invoice = _ppArgs.getThis(); salesFormLetter_Invoice.getOutputContract().parmAllJournals();
With this I can iterate and perform my tasks on the posted invoices.
This works fine when posting invoices manually, in batch on the client but not when doing it in batch on the server.
The set returned by parmAllJournals (or rather base64 encoded string) is empty and I've tried a few other ways such as:
custInvoiceJour = salesFormLetter_Invoice.parmJournalRecord() as CustInvoiceJour; custInvoiceJour = salesFormLetter_Invoice.getSalesFormLetterContract().parmJournal() as CustInvoiceJour;
But I'm not getting any journals.
I've gone through a great deal of code down to Sysop framework trying to figure it out but I can't find anything obvious.
Did anyone else struggle with this?
Thanks
*This post is locked for comments
I am facing with the same issue. I looked in available variables when FormletterServiceMultithread.endPosting() is executed but corresponding formLetterOutputContract does not have "AllJournals" populated as well.
Would it be possible to share the full code that allows to get "AllJournals" when invoices are posted via batch?
I found a way to do it, basically the salesFormLetter isn't used the same way in batch as when done manually so I added my event handler on FormletterServiceMultithread.endPosting() as well as some code to determine where it was called from:
if(thisRef is SalesFormLetter_Invoice) { salesFormLetter_Invoice = thisRef; formletterOutputContract = salesFormLetter_Invoice.getOutputContract(); } else if(thisRef is FormletterServiceMultithread) { formletterService = thisRef; formletterOutputContract = formletterService.getOutputContract(); }
Note that you also have to check the journal type as this will be used for all types of journals posted in batch, as in my case I had to check for CustInvoiceJour. Might not be the neatest solution, but it does work.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,902 Super User 2024 Season 2
Martin Dráb 229,336 Most Valuable Professional
nmaenpaa 101,156