AR Generate Recurring Invoice

My recurring invoices stopped working. The process throws the below error. Support hasnt been able to figure it out. I am not sure where the disconnect is. Looks like it can be one of the invoices. Any ide how to troubleshoot it.

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: Object reference not set to an instance of an object.
Stack Trace:
at Erp.Internal.AR.GenerateRecInv.RunGenerateRecInv(String groupID, String custList, String cycleCodeList, Int32 firstDayOfWeek, String selectedList, Boolean billToFlag, Nullable1 cutoff_date, String& Invoices, Int32& numInvoices, String& msgNumInvoices, String& msgLOCErrors, Decimal& grpTotalInvAmt) in c:\_Releases\ERP\RL10.1.600.0\Source\Server\Internal\AR\GenerateRecInv\GenerateRecInv.cs:line 387 at Erp.Internal.AR.RecurringInvGeneration.main_block() in c:\_Releases\ERP\RL10.1.600.0\Source\Server\Internal\AR\RecurringInvGeneration\RecurringInvGeneration.cs:line 170 at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\3.1.600.27\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 88 at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\3.1.600.27\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 54 at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in c:\_Releases\ICE\3.1.600.0\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63 at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in c:\_Releases\ICE\3.1.600.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 535 at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in c:\_Releases\ICE\3.1.600.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 535 at Ice.Services.Lib.RunTaskSvcFacade.RunTask(Int64 ipTaskNum) in c:\_Releases\ICE\3.1.600.0\Source\Server\Services\Lib\RunTask\RunTaskSvcFacade.cs:line 87 at SyncInvokeRunTask(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func2 func) in C:_Releases\ICE\3.1.600.27\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59
at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func2 func) in C:\_Releases\ICE\3.1.600.27\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 28 at Epicor.Hosting.Wcf.EpiOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) in C:\_Releases\ICE\3.1.600.27\Source\Framework\Epicor.System\Hosting\Wcf\EpiOperationInvoker.cs:line 23 at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) at System.ServiceModel.Channels.SecurityChannelListener1.ReceiveItemAndVerifySecurityAsyncResult`2.InnerTryReceiveCompletedCallback(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)
at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Security.NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest)
at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)

Best chance is to by process of elimination, widdle down your testing records until you find the culprit record. I’ve had similar Object Ref errors in other areas of epicor that stopped a process due to one bad record (usually one with a required record in another table that didn’t exist)

You could also try to put some bpms to log the invoice being worked on and you should see the last one before the error happened, if it is always the same then you have your culprit.

You can try a data directive in InvcHead/InvcDtl, or a processing bpm on ARInvoice.Update or ARInvoice.CopyInvoiceLines.

Thanks i will try this!

Here is the key of your error:
firstDayOfWeek, String selectedList, Boolean billToFlag, Nullable1 cutoff_date

There is a field at the customer bill to: Billing day.
Seems like your setup is to bill only the first day of the week, causing issues with your recurring cycle.
Try to change that to ‘All days’

We have the same issue in 10.2.700.13 – it appears to be a bug… when you either have 2 Recurrings Setup and reach your third generated Invoice.

I havent tried Billing Day yet.

It worked fine for 2 generations and third one is failing.

Support only has a KB on making sure your Customers are Active (Valid ShipTo, Valid PayTo…) all of mine are. They also have a KB on making sure your EAD is set properly mine is.

1 Like

I can try to track this one but will need some clarification. What is the setup for both recurring cycles, what is the customer setup.

With that I can try to replicate it.



Example of 3 Customers in the past where it worked:

SELECT Posted, CustNum, CycleCode, * FROM Erp.InvcHead WHERE CycleCode <> ''

I ran through all the KBs and currently my assumption is that somehow when Epicor runs query to get invoices brought over it detects 2 and may be having issues… It should technically support 2 or more recurring’s.


It worked fine twice, doesnt work a third time anymore with no extra changes.

1 Like

Thanks Juan but all the customers are setup as Weekly with All Days. I verified that via a query

Ok, so I had no error, maybe I skip a step or did something different, here is what I did:

  • Created 2 Customers
  • Created 2 Recurring Codes
  • Created 2 Invoices, one line each, one for each customer and code so c1/r1 c2/r2
  • Created another 2 Invoices next month, using Get Recurring Invoices and Manual Selection
  • Repeated previous steps another 3 times, no errors.

Any idea what I might need to do different to trigger this.

Let me do a better debug trace. See if I can replicate it from scratch. Thank you for looking into this. Obviously there are numerous KB Articles on this weird error and sometimes it has to do with Invalid Data on Customer, EAD issues… But couldnt narrow it down yet.

1 Like

Getting DEEP into the weeds. Happy hunting!


Thanks for trying it on your end Jonathan.

Can you see if any customer in the generating invoice list has a blank Sales Rep Code? From my experience, that normally caused an issue for me.

Thank you, i looked at all the recurring invoices and assigned a rep to the ones missing but still getting this error from Epicor.

I mean make sure you have Sales rep value on the customers, not on the invoices. The field is Customer.SalesRepCode, labeled Salesperson in Customer Maintenance.

My SalesRep are filled in. In both Customer & InvcHead (old invoices that the Recurring initiated from). Still havent investigated further - busy.

I got a response from Epicor

“The issue resides in the recurring cycle. The cycle already created have reached their duration limit. Please try to create a new recurring cycle”

I will try and update, not ideal but lets see.

Did you try a new cycle?

1 Like

I had to create a recurring cycle and transfer all the recurring invoices to the new cycle.