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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Want to call my custom method after sales order converting to invoice in batch AX

(1) ShareShare
ReportReport
Posted on by 4
Hi all,
 
I want to call custom method after sales sales order converting to invoice in batch like after whole process completed and batch job ended. I want the exact class and method name .


 
Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,632 Most Valuable Professional on at
    The class you seem to be interested in is SalesFormLetter_Invoice. There are several possible method, depending on what exactly you want. Maybe afterOperationBody() meets your requirements the best.
     
    Note that you should learn a bit about the FormLetter framework to understand which classes are responsible for which parts of the process and how the posting works in general. For example, don't forget that a posting can process several orders and produce several invoices, an order may be invoiced just partially, a single invoice may cover multiple sales orders, it may be a proforma posting, there are four execution modes (two of them utilizing batch jobs)...
  • CU24111428-0 Profile Picture
    4 on at
    Hi martin,
    Thanks for your reply. Actually i want to post multiple sales orders to invoice in batch and can you tell me how can i get invoice number , sales order number in afterOperationBody() method?
    Thanks
  • Suggested answer
    Martin Dráb Profile Picture
    239,632 Most Valuable Professional on at
    You can get the list of created invoices from formletterOutputContract.parmAllJournalsPacked():
    CustInvoiceJour invoiceJour;
    
    SetEnumerator jourEnumerator = Set::create(formletterOutputContract.parmAllJournalsPacked()).getEnumerator();
    while (jourEnumerator.moveNext())
    {
        invoiceJour = jourEnumerator.current();
    }
    For each invoice, you then need to check CustInvoiceSalesLink table to see which sales orders are included in the given invoice. Calling invoiceJour.queryCustInvoiceSalesLink() will give you such a query.
     
    (Hopefully it's the same in AX 2012; I'm looking into F&O).
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 804

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 639 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 528

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans