Hi-
I'd like to know when a user has removed a line item from an Invoice.
In that use case, we have some custom records regarding payments made against that line item that I need to adjust.
What options do I have for registering a handler or otherwise getting notified so I can execute some custom code?
Thanks!
Subscribe to event for when invoice line item deleted ?
Moderator: Phil Barton
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Subscribe to event for when invoice line item deleted ?
Without knowing more, here are a couple general thoughts (that we use in conjunction sometimes):
- Tuck some lines information in the Tags area for the invoice. It can allow you to determine if a line is added/removed.
- Register for the "InvoiceChanged" notification. It will call your handler if user changes the invoice status (Sent, Quote,...).
- Use the OrderSaving event and open the prior version of the order to do a compare.
- Use the OrderSaved event and open the prior version of the order to do a compare.
- Monitor each invoice collection in a Shell package.
Code: Select all
// Pseudo-code from memory of another dev!
invoice = invoice you want to monitor.
var invoiceLines = (IBindingList)invoice.GetProperty("Lines");
invoiceLines.ListChanged += MyHandler;
Bob Richards, Senior Software Developer, SoftPro
Re: Subscribe to event for when invoice line item deleted ?
Ok, thanks for the tip, and the example code for monitoring list changes.
....and it looks like the ListChangedEventArgs param offers a ListChangedType property which can be compared against the ListChangedType .ItemDeleted enum value.
Looks promising.
Regards-
....and it looks like the ListChangedEventArgs param offers a ListChangedType property which can be compared against the ListChangedType .ItemDeleted enum value.
Looks promising.
Regards-