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

Linking Payments/Settlements to Invoices in Database Tables

(0) ShareShare
ReportReport
Posted on by 5

Hi there, we are attempting to pull invoices from our Dynamics 365 system into our BI reporting tool via an ODBC connector, however we don't fully understand the database structure behind Dynamics. In order for me to recreate debt at a given date I need to get all of the invoices and all payments/settlements associated with a given invoice. As highlighted in another recent thread (community.dynamics.com/.../1215057), when looking at a particular invoice we can click 'View Settlements' to see all of the payments for this invoice, however we can't see how this is tied together in the database.

Right now I can see the invoices are held in the VGRCustTrans3 table and our payments in the CustomerPaymentJournalLines table. I can match VGRCustTrans3.LastSettleVoucher = CustomerPaymentJournalLines.Voucher but I believe this will only give me the most recent payment not all of the payments. I also see a CustomerPaymentJournalLines.MarkedInvoice field but this does not seem to always be populated - sometimes it shows an invoice number and sometimes it just shows *.

It seems to me like this VGRCustTrans3 which has been used for reporting in the past might have been created internally, however I believe everyone involved with setting up our Dynamics system has moved on so I am reverse-engineering a bit here. How consistent is the database structure for Dynamics 365? Is there a different, standard table that I should be using to list invoices and is there a way to link from there to a set of payments/settlements? I did see another thread referring to a CustSettlement table but I don't see anything with that name in our database.

Appreciate any guidance.

I have the same question (0)
  • OsmanIstanbul Profile Picture
    2,818 on at

    Hi,

    You can use custtrans and custsettlement tables. relation between these tables is a 1-n relation. Custtrans.recId=custsettlement.RefTransId. Both invoices and payment are in custtrans table and their settlements are in custsettlement table.

    Roughly as below:

    Custtrans CustSettlement
    amount RecId TransRecId SettleAmoun OffsetTransRecId
    Inboice1 100 1 1 -25 2
    Payment1 -25 2 2 25 1
    Payment2 -25 3 1 -25 3
    3 25 1
  • Ben Mc Profile Picture
    5 on at

    Hi Osman, I fear this answers one of my questions at least - I don't see a CustTrans or CustSettlement table in the database I have access to. Could this be some different version of Dynamics with a slightly different structure?

  • Suggested answer
    OsmanIstanbul Profile Picture
    2,818 on at

    Hi,

    on d365 you are not able to access tables. you can use entities. There are not out of box entities for these tables. You should create entities for these tables.

    Regards.

  • Ben Mc Profile Picture
    5 on at

    Ah I see, presumably that means the ODBC connector we use is presenting the entities to me as tables so I can query then with SQL. Alright thank you for the pointers, I will see if we can get someone to modify our configuration to add new entities for those tables so that I can access them.

  • André Arnaud de Calavon Profile Picture
    303,706 Super User 2026 Season 1 on at

    Hi Ben,

    I'm not convinced if you are querying a Dynamics 365 database (AXDB) or an own BYOD database. Do you have Dynamics 365 running in the cloud or on premise?

    The VGRCustTrans3 table is not something delivered out of the box by Microsoft; this should be at least a custom table or entity.  

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans