Skip to main content



No record found.

Microsoft Dynamics AX forum

How to join the Generaljournalaccountentry table to the Custtrans table?

Posted on by 5

Hello, I need to filter for vouchers beginning with CIV, WO, etc with the ledger account beginning with 113120. To my understanding this requires bringing the ledger account over to the custtrans table. I am a little confused as there is a generaljournalentry and other tables. What is the relationship needed to accomplish this? thanks 

  • Verified answer
    udaY-ch Profile Picture
    udaY-ch 4,616 on at
    RE: How to join the Generaljournalaccountentry table to the Custtrans table?


    Use custtrans voucher to connect genenraljournalentry table through subledgervoucher

    And from generaljournalentry you will find a connection to generaljournalaccountentry by using recid

    Something like this,

    Public static void voucher(Args _args)
        CustTrans                   custTrans;
        GeneralJournalEntry         generalJournalEntry;
        GeneralJournalAccountEntry  generalJournalAccountEntry;
        select custTrans
            where custTrans.Voucher == "Yourvoucher"
        join generalJournalEntry
            where generalJournalEntry.SubledgerVoucher == custTrans.Voucher
        join generalJournalAccountEntry
            where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
            info(strFmt("generalJournalAccountEntry %1", generalJournalAccountEntry.TransactionCurrencyAmount));


Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,914 Super User

Martin Dráb Profile Picture

Martin Dráb 225,549 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans