Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How to get Sales Invoi...
Finance forum
Answered

How to get Sales InvoiceId after sale order invoiced ?

Posted on by 1,867
Dears 
 
As soon as the sales order invoice number is posted, I need read invoice number. I created a post handler, but it doesn't work. How can I get the invoice number after the sales order has been posted?
 
 class SalesInvoiceIdCall
{
    [PostHandlerFor(formStr(SalesEditLines), formMethodStr(SalesEditLines, closeOk))]
    public static void SalesEditLines_Post_closeOk(XppPrePostArgs args)
    {
        FormRun sender = args.getThis();
        SalesParmUpdate salesParmUpdate;
        CustInvoiceJour custInvoiceJour;
        InvoiceId invoiceId;
        salesParmUpdate  = sender.dataSource(formdatasourcestr(SalesEditLines, SalesParmUpdate)).cursor();
        
        if(salesParmUpdate.DocumentStatus == DocumentStatus::Invoice)
        {
         
           info(strFmt("U r InvoiceID %1",CustInvoiceJour::findFromParmId(salesParmUpdate.ParmId).InvoiceId));

            //Integration code call
        }
   
    }


   

}
 
  • Verified answer
    Faqruddin Profile Picture
    Faqruddin 1,867 on at
    How to get Sales InvoiceId after sale order invoiced ?

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,246 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,041 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans