Wednesday, January 9, 2019

How to get an invoice number of a payment in dynamics AX 2012 / D365 F&O X++

Below is the code I have written  in D365 F&O for getting the invoice numbers for payments which are settled with the invoices.

Please change the code according to your requirement.

class VendTransTest
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
       
        VendTrans               vendTransPayment, vendTransinvoice;
        TransDate               fromTransDate = 01\01\2018;
        TransDate               toTransDate = str2Date("12/31/2018", 213);
        ;
        while select vendTransPayment where vendTransPayment.TransType == LedgerTransType::Payment
                                &&  vendTransPayment.TransDate >= fromTransDate
                                && vendTransPayment.TransDate <= toTransDate
        {
                         
                while select vendTransinvoice where vendTransinvoice.LastSettleVoucher == vendTransPayment.Voucher
                 {
                            info(vendTransinvoice.invoice);
                 }

            }
        }
       
    }

}

@Rahul 

1 comment:

  1. Integrating OMGClick integration in RSL Helper adds serious value for automation fans. On the Dynamics side, fetching an invoice number for a payment in AX 2012 or D365 F&O via X++ can be done by tracing the VendTrans or CustTrans record linked to the LedgerJournalTrans. Smart automation meets deep ERP logic love this crossover!

    ReplyDelete

What is the primary purpose of using a Solution in Microsoft Power Platform & ALM?

As organizations embrace low-code development with Microsoft Power Platform , it becomes essential to manage and govern apps, flows, and dat...