Subscribe to event for when invoice line item deleted ?

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
toddsou
Posts: 75
Joined: Wed Jul 25, 2012 9:39 am

Subscribe to event for when invoice line item deleted ?

Post by toddsou »

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!
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Subscribe to event for when invoice line item deleted ?

Post by BobRichards »

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.
Example of monitoring list changes:

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
toddsou
Posts: 75
Joined: Wed Jul 25, 2012 9:39 am

Re: Subscribe to event for when invoice line item deleted ?

Post by toddsou »

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-
Post Reply