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)

Get Invoice Reference Number

(0) ShareShare
ReportReport
Posted on by 2,075

Dear All,

I need advice,

at Form voucher transaction, for example data : journal number GJT-XXXXX, Voucher IJVXXXX, Ledger Account for cost of material

i want get invoice reference number,

from where table I could get the invoice reference number ?

Thank you

Invoice-Reference-Number.jpg

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,020 Super User 2025 Season 2 on at

    Hi Benjamin,

    Is it a purchase or sales invoice? I assume you need the Invoice number? It can be found in the CustTrans or VendTrans table. For both tables you need to filter on the voucher number and the transaction/posting date to get a unique record.

  • Suggested answer
    Ajit Profile Picture
    8,755 on at

    You can refere method 'findFromTaxTrans' of vendInvoiceJour table.By using that you will get vendor invoice id.

  • benjamin84 Profile Picture
    2,075 on at

    danke andre,

    i'll check first.

    :)

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    You can check field invoiceId of either table custInvoiceJour(for customer transactions)
    (or) table vendInvoiceJour(for vendor transactions) with the help of voucherid and invoice date.

    Please use the following job to get the invoice reference number for the given journal number and voucher id

    static void InvoiceTrans(Args _args)
    {
    GeneralJournalEntry generalJournalEntry;
    GeneralJournalAccountEntry journalAccountEntry;
    SubledgerVoucherGeneralJournalEntry subledgerVoucherGeneralJournalEntry;
    CustInvoiceJour custInvoiceJour;
    VendInvoiceJour vendInvoiceJour;
    DataAreaId company;

    company = curext();

    // Customer invoice reference number for the given journal number and voucherId
    select journalAccountEntry
    join generalJournalEntry
    where ((generalJournalEntry.RecId == journalAccountEntry.GeneralJournalEntry)
    && (generalJournalEntry.SubledgerVoucherDataAreaId == company) // Current company
    && (generalJournalEntry.JournalNumber == "Jour1") // Specify journal number here
    && (generalJournalEntry.SubledgerVoucher == "vouc1")) // Specify voucher here
    join Voucher, AccountingDate from subledgerVoucherGeneralJournalEntry
    where (subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId)
    join custInvoiceJour
    where custInvoiceJour.InvoiceDate == subledgerVoucherGeneralJournalEntry.AccountingDate
    && custInvoiceJour.LedgerVoucher == subledgerVoucherGeneralJournalEntry.Voucher;
    info(strFmt("Customer Invoice reference number %1", custInvoiceJour.InvoiceId));

    // Vendor invoice reference number for the given journal number and voucherId
    select journalAccountEntry
    join generalJournalEntry
    where ((generalJournalEntry.RecId == journalAccountEntry.GeneralJournalEntry)
    && (generalJournalEntry.SubledgerVoucherDataAreaId == company) //Current company
    && (generalJournalEntry.JournalNumber == "Jour2") // Specify journal number here
    && (generalJournalEntry.SubledgerVoucher == "vouch2")) // Specify voucher here
    join Voucher, AccountingDate from subledgerVoucherGeneralJournalEntry
    where (subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId)
    join vendInvoiceJour
    where vendInvoiceJour.InvoiceDate == subledgerVoucherGeneralJournalEntry.AccountingDate
    && vendInvoiceJour.LedgerVoucher == subledgerVoucherGeneralJournalEntry.Voucher;
    info(strFmt("Vendor Invoice reference number %1", vendInvoiceJour.InvoiceId));
    }

    Thanks,

    Chaitanya Golla

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

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans