NullReferenceException When Adding an Order Header Misc Charge

We updated our Epicor 10 installation to version 10.2.300.12 a couple of weeks ago, and our CSRs are occasionally encountering errors like this in the Order Entry screen:

I checked the application server log, and it shows errors like this:

Server Side Error
Server Side Exception
EpicorServerException
Description: BPM runtime caught an unexpected exception of ‘NullReferenceException’ type.
See more info in the Inner Exception section of Exception Details.
Program: Erp.Services.BO.SalesOrder.dll
Method: OHOrderMscAfterUpdate
Line Number: 21847
Column Number: 25
Original Exception Type: NullReferenceException
Server Trace Stack: at Erp.Services.BO.SalesOrderSvc.OHOrderMscAfterUpdate() in C:_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.cs:line 21847
at Ice.Services.Trace.TablesetProfilingCollector.DoRowEventTrace(String tableName, String methodName, Int32 rowCount, Action action) in C:_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 144
at Ice.TablesetBound3.CreateRow(IceDataContext dataContext, Int32 tableNum, IIceTable table, IceRow newTablesetRow, TablesetProfilingCollector parentTraceCollector) in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 1175 at Ice.TablesetBound3.WriteTable(IceDataContext dataContext, Int32 tableIndex, IIceTable table, TablesetProfilingCollector parentTraceCollector) in C:_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 965
at Ice.TablesetBound3.InnerUpdate[TUpdater](IceDataContext dataContext, TFullTableset tableset) in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 874 at Erp.Services.BO.SalesOrderSvc.Update(SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.Designer.cs:line 3896 at Epicor.Customization.Bpm.MethodCustomizationBase23.RunDirectives(TParam parameters) in C:_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 193
at Epicor.Customization.Bpm.CustomizationBase23.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 73 at Epicor.Customization.Bpm.BO816D7697AF6141A89C4B07F79FC09232.SalesOrderSvcCustomization.Update(SalesOrderTableset& ds) at Erp.Services.BO.SalesOrderSvcFacade.Update(SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrderSvcFacade.cs:line 9195 at Erp.Services.BO.SalesOrderSvc.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, String& cAgingMessage, SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.cs:line 21715 at Epicor.Customization.Bpm.BOD3B73E313AB048A5ABA8914B8CA4C199.MasterUpdateImpl.ExecuteBase(MasterUpdateParameters parameters) at Epicor.Customization.Bpm.MethodCustomizationBase23.RunDirectives(TParam parameters) in C:_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 197
at Epicor.Customization.Bpm.CustomizationBase23.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 73 at Epicor.Customization.Bpm.BOD3B73E313AB048A5ABA8914B8CA4C199.SalesOrderSvcCustomization.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, String& cAgingMessage, SalesOrderTableset& ds) at Erp.Services.BO.SalesOrderSvcFacade.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, String& cAgingMessage, SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrderSvcFacade.cs:line 5928 at Epicor.Customization.Bpm.BOD3B73E313AB048A5ABA8914B8CA4C199.MasterUpdatePostProcessingDirective_Check_for_Credit_Message_05D00DD43949421C9035BDA6D62E3E58.A005_InvokeBOMethodAction() at Epicor.Customization.Bpm.BOD3B73E313AB048A5ABA8914B8CA4C199.MasterUpdatePostProcessingDirective_Check_for_Credit_Message_05D00DD43949421C9035BDA6D62E3E58.ExecuteCore() at Epicor.Customization.Bpm.DirectiveBase3.Execute(TParam parameters) in C:_Releases\ICE\ICE3.2.300.12\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 147

I was able to reproduce it on my test system by opening an order and adding an order header miscellaneous charge with a zero amount. If the order is on credit hold, I get a prompt like this:

image

If I answer yes, I get the error listed above.

I tried disabling all the method directives on the SalesOrder.Update and SalesOrder.MasterUpdate methods, I also ran the base order form to rule out any customization behaviors, but I still get this error.

If I either uncheck Ready To Process, or change the amount on the charge to something other than zero, it saves the changes without error.

Has anyone else encountered this?

I also noticed that before it allowed zero amounts in MSC charges. (our CSR’s were adding the line, so they do not forget, and then later edit with right value. If not, I had a BPM checking for zero amount msc charge, not allowing the save…

But

in 10.2 we noticed they do not allow this anymore. (not sure if it was your type of error, or a normal message from Epicor)
CSR’s are now adding the row with 1$ amount not to get an error and I changed my BPM to not allow save if = 1$…

Pierre

Based your stack trace, its likely some custom coding with the BPM’s when it attempts to perform the MasterUpdate (Erp.Services.BO.SalesOrderSvc.MasterUpdate).

I disabled the directives, and I still get the error:

System.NullReferenceException: Object reference not set to an instance of an object.
at Erp.Services.BO.SalesOrderSvc.OHOrderMscAfterUpdate() in C:_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.cs:line 21847
at Ice.Services.Trace.TablesetProfilingCollector.DoRowEventTrace(String tableName, String methodName, Int32 rowCount, Action action) in C:_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 144
at Ice.TablesetBound3.CreateRow(IceDataContext dataContext, Int32 tableNum, IIceTable table, IceRow newTablesetRow, TablesetProfilingCollector parentTraceCollector) in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 1175 at Ice.TablesetBound3.WriteTable(IceDataContext dataContext, Int32 tableIndex, IIceTable table, TablesetProfilingCollector parentTraceCollector) in C:_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 965
at Ice.TablesetBound3.InnerUpdate[TUpdater](IceDataContext dataContext, TFullTableset tableset) in C:\_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 874 at Erp.Services.BO.SalesOrderSvc.Update(SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.Designer.cs:line 3896 at Erp.Services.BO.SalesOrderSvcFacade.Update(SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrderSvcFacade.cs:line 9195 at Erp.Services.BO.SalesOrderSvc.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, String& cAgingMessage, SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrder.cs:line 21715 at Erp.Services.BO.SalesOrderSvcFacade.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, String& cAgingMessage, SalesOrderTableset& ds) in C:\_Releases\ERP\UD10.2.300.12\Source\Server\Services\BO\SalesOrder\SalesOrderSvcFacade.cs:line 5928 at SyncInvokeMasterUpdate(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\ICE3.2.300.12\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59
at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in C:_Releases\ICE\ICE3.2.300.12\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 28

It’s the same error, it just the stack trace differs because no directives are firing.

I only get that error when adding new charges with zero amounts, not when I update existing ones. And even then, it only seems to happen if I get the credit hold prompt and answer yes.