Does The Rollup of InvoiceDetail Totals to Invoice Totals Increase Depth Count of the Executing Plugin? RRS feed

  • Question

  • The InvoiceDetail rolls up certain details into the Invoice Entity to keep the totals in sync. I'm not sure if this is happening with a plugin in the system or through some other method.

    If it is a plugin, does it count as a +1 to the depth count of my existing plugins executing in sequence (i.e. the plugin that caused the update of the InvoiceDetail), and as a result could it trigger an infinite loop exception if I was already at the max 7 depth?

    Monday, February 28, 2011 4:01 PM


All replies

  • I'd give it a test to see if your plugin's were invoice plug-ins are firing by having them write to a file if you are not using online.  I guess I am assuming this is on-prem CRM 4 at this point.  I would think that the rollup would cause an update that would fire any update plugin's on the invoice entity, but I cannot confirm this without further testing.


    Jamie Miley
    Monday, February 28, 2011 4:16 PM
  • I have tested this by adding an orderdetail using plugin and the Total on order is updated by CRM.
    Regards Faisal
    Monday, February 28, 2011 4:39 PM
  • Yeah, when updating an InvoiceDetail (or OrderDetail it appears) automatically updates the associated Invoice (or Order)... you get that out of the box for free with CRM.

    My concern is if this is being done by the system with a Plugin instead of by some other internal mechanism that it will increase the Depth count of my existing plugins (I have a plugin that is updating and creating InvoiceDetails).

    Monday, February 28, 2011 4:42 PM
  • I don't think that it is a plugin that makes the changes.  I do think it is probably something that causes a backend update call though. 

    This will fire your update plugins (on invoice) if I am correct.  If that causes an update on the invoice and the plugins registered on invoice update will fire.  If those plugin's cause another invoicedetail update that fires those plugins again on invoice you could hit an infinite loop, although I think there are is testing for this or it blows up at some point.   You could test for certain conditions in your pre and post contexts in order to not do something based on certain conditions or to tell what changed. 

    Again, the only way I can think of to test this is to add a writeline to an output file showing what fired and when. 

    I don't think that it is a plugin though so you probably don't have to worry about plugin depth count.
    Jamie Miley
    Monday, February 28, 2011 7:18 PM
  • This has been answered from a similar post in another forum regarding CRM 2011:


    • Marked as answer by jcaruso_fp Monday, February 28, 2011 7:56 PM
    Monday, February 28, 2011 7:56 PM