web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Retrieve sales invoice journals when posting in batch

(0) ShareShare
ReportReport
Posted on by 25

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 have the same question (0)
  • Verified answer
    Seeker Profile Picture
    25 on at

    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.

  • Oksana Tsionel Profile Picture
    44 on at

    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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans