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 :
Microsoft Dynamics AX (Archived)

Best approach for kicking off process when invoice is fully paid

(0) ShareShare
ReportReport
Posted on by 747

Hey all,

I have a somewhat strange requirement for a data export. The client needs to send over invoice line information to an external system when a payment journal is posted. I've let them know that there's definitely not a 1 to 1 link but they've agreed that we should only export the lines when the invoice is fully paid. Essentially I am just populating a custom table with some of the flattened data for now, which will get picked up by a batch job to actually do the export.

Anyway, I'm having a hard time trying to find a spot to inject this code. I'm thinking in the VendSettlement.insert() method, if that record is related to a VendTrans which has an "invoice" field populated, I could check to see if there is a VendTransOpen record. If there are no vendTransOpen records for that VendTrans, then I would populate this custom table, otherwise it would just skip that process until the next payment is posted against that invoice.

I'm somewhat unfamiliar with the VendTrans table structures, so I'm not sure if there can be multiple VendTrans per invoice. Also not sure if there's any instances where my query would fail in VendSettlement.insert() due to there being multiple payments posted for the same invoice at the same time, if that's a thing. I'm assuming the first payment would have the vendTransOpen record even though the second payment would close it out.

I'm just looking for any confirmation that my way should fit the requirements or I'm all ears for any other suggestions.

Thanks,

Kyle

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Brandon Wiese Profile Picture
    17,790 on at

    VendTrans records don't split for Accounts payable like InventTrans records do for inventory.  Every vendor invoice will have exactly one VendTrans record.

    Rather than look for a VendTransOpen record, you could just look for a non-empty Closed date on the VendTrans record itself, in both the .insert() and .update() methods.  If it had an Invoice field then it was almost certainly an invoice, but a better check would be if a related VendInvoiceJour record could be found using the standard relation.

    I would be concerned about an invoice being closed more than once, such as by reversal and re-payment, or un-settlement and re-settlement, etc., and that somehow resulting in the same VendTrans record being output more than once.  Perhaps that's a harmless possibility, but it will happen eventually.

  • Brandon Wiese Profile Picture
    17,790 on at

    You definitely want to tap the .insert() also.  Invoices for $0 create a VendTrans record that is closed immediately and there will never be a settlement, for example.  I'm not familiar with the code path for pre-payments, but you could imagine how they might be settled immediately upon .insert() also under the right conditions.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 44

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans