Hi Everyone,
I need to update a custom table GRNTable by setting the Status field to "Invoiced" when a Purchase Order is invoice posted in D365 F&O.
GRNTable
Status
Could someone guide me on which method or class I should extend or handle this logic in? Should I use the PurchFormLetter_Invoice class or is there a better place to implement this update after invoice posting?
PurchFormLetter_Invoice
Thanks,
Ayushaman
Hi Ayushaman,
Just a couple of points to better understand and guide you:
This will help determine the best place to put your logic.
If you're using the standard invoice posting process, I recommend adding a toggle checkbox (parameter) either in the PurchParameters or in a custom parameter table. That way, your custom logic (updating GRNTable.Status to "Invoiced") will only execute if the toggle is enabled. This approach gives better control and avoids running your logic unnecessarily.
GRNTable.Status
Then, you can safely place your code inside a class extension of PurchFormLetter_Invoice, preferably in the method, with a condition to check the toggle value.
Hope it helps ;) and let me know if you need more help!
POInvoicedFlag
VendInvoiceJour
VendInvoiceJour.insert()
PurchId
[ExtensionOf(classStr(PurchTableType))] final class PurchTableType_WCL_Extension { public void updateBackStatus() { next updateBackStatus(); PurchTable purchTable = this.purchTable(); // i can't directly take a buffer like this if (purchTable.PurchStatus == PurchStatus::Invoiced) { GRNTable grnTable = GRNTable::findByPurchId(purchTable.PurchId, true); if (grnTable) { grnTable.PurchStatus = PurchStatus::Invoiced; grnTable.update(); } } } }
PurchTable purchTableLocal = purchTable;
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,004
André Arnaud de Cal... 865 Super User 2025 Season 2
Sohaib Cheema 582 User Group Leader