Run Function after Invoice Group Posting

I have an Epicor Function that I need to run after an AR Invoice Group has been posted. I have examined a trace and the only Posting type method that is called during the process is InvcGrp.PrePostInvoices method. However, this method is called as soon as Action → Group → Post is selected, whether the process is submitted or not. Once submitted, no further methods are called as the actual posting of the group appears to be handled by a system process.

Any other trigger available for posting an AR Invoice Group besides monitoring the system agent for the process to complete?

You might look at the InvcGrp table and do a data directive. It looks like there is a field in there called PostInProcess… perhaps when that changes from True to False you could trigger your function…

Data directive on InvcHead that fires when InvcHead.Posted goes from false to true.

Personally, I’d add a UD field that holds a datetime stamp the moment an invoice is posted. You data directive then records the time. Then run your function on a schedule and scoop up recently posted invoices and does whatever.

Note that this is my spitball response. I’ve never watched the full lifecycle of a InvcGrp record. I just know the system removes the InvcGrp entry once posting is complete. So my first instinct is to go to the remaining record (the invoice itself) and go from there. I’m also not sure what your end goal is here, but I kind of assumed some kind of alert. I always batch process alerts and to that end usually set alerts to land every 2-4 hours unless it’s something absolutely critical. People have enough email as-is.

Thanks for your help, @dr_dan & @jtownsend.

you got me pointed in the right direction.

  1. In-Transaction Data Directive on the InvcGrp table watching for a deleted row.
  2. Store needed data in the callContextBpmData fields.
  3. Enable Standard Data Directive.
  4. Call Epicor Function from Standard directive with parameter values from callContextBpmData.

This could get triggered if a user creates / then deletes an InvcGrp, but the next function checks for matching records in the InvcHead table and completes gracefully if none found.

Thanks again!

I like it. Elegant.