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)