0
votes

I've updated our test environment to the latest version of Acumatica 5.10.0752. After updating our sync process has started to fail when inserting an item into a sales order. Note that no code changes were implemented to the sync process and the only change was to apply the latest update to Acumatica. I've been struggling with this and can't seem to solve adequately and could use a bit of help..

Here is the stack trace:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Data.PXException: Error #112: An error occurred while processing the field InventoryID : Object reference not set to an instance of an object.. ---> System.NullReferenceException: Object reference not set to an instance of an object. at PX.Objects.SO.SOOrderEntry.SOLine_CuryUnitCost_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) at PX.Data.PXCache.OnFieldDefaulting(String name, Object row, Object& newValue) at PX.Data.PXCache1.SetDefaultExt(Object data, String fieldName) at PX.Objects.SO.SOOrderEntry.SOLine_UOM_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) at PX.Data.PXFieldUpdated.Invoke(PXCache sender, PXFieldUpdatedEventArgs args) at PX.Data.PXCache.OnFieldUpdated(String name, Object row, Object oldValue, Boolean externalCall) at PX.Data.PXCache1.SetDefaultExt(Object data, String fieldName) at PX.Objects.SO.SOOrderEntry.SOLine_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) at PX.Data.PXFieldUpdated.Invoke(PXCache sender, PXFieldUpdatedEventArgs args) at PX.Data.PXCache.OnFieldUpdated(String name, Object row, Object oldValue, Boolean externalCall) at PX.Data.PXCache1.a(TNode A_0, TNode A_1, IDictionary A_2, PXCacheOperation A_3, Boolean A_4) --- End of inner exception stack trace --- at PX.Data.PXCache1.a(TNode A_0, TNode A_1, IDictionary A_2, PXCacheOperation A_3, Boolean A_4) at PX.Data.PXCache1.a(TNode A_0, TNode A_1, IDictionary A_2, PXCacheOperation A_3) at PX.Data.PXCache1.Insert(IDictionary values) at PX.Data.PXCache1.Update(IDictionary keys, IDictionary values) at PX.Data.PXGraph.ExecuteUpdate(String viewName, IDictionary keys, IDictionary values, Object[] parameters) at PX.Data.PXGraph.CopyPasteCommitChanges(String viewName, OrderedDictionary keys, OrderedDictionary vals) at PX.Api.SyImportProcessor.SyStep.CommitChanges(Object itemToBypass, PXFilterRow[] targetConditions) at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable() at PX.Api.ScreenUtils.Submit(String screenId, Command[] commands, SchemaMode schemaMode, PXGraph& graph, String& redirectContainerView, String& redirectScreen, Boolean mobile) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable1 commands, SchemaMode schemaMode, Boolean mobile, PXGraph& forceGraph, String& redirectContainerView, String& redirectScreen) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable`1 commands, SchemaMode schemaMode) at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands) --- End of inner exception stack trace ---

Here is a code snippet that worked fine before the update:

cmds.Add( SO301000.DocumentDetails.ServiceCommands.NewRow );
cmds.Add( new AcumaticaApiWS.Value { Value = item.InventoryId, LinkedCommand = SO301000.DocumentDetails.InventoryID } );
cmds.Add( new AcumaticaApiWS.Value { Value = item.Quantity, LinkedCommand = SO301000.DocumentDetails.Quantity } );
cmds.Add( new AcumaticaApiWS.Value { Value = item.UnitPrice, LinkedCommand = SO301000.DocumentDetails.UnitPrice } );
cmds.Add( new AcumaticaApiWS.Value { Value = item.WebCode, LinkedCommand = SO301000.DocumentDetails.WebCode } );
cmds.Add( new AcumaticaApiWS.Value { Value = item.ExtPrice, LinkedCommand = SO301000.DocumentDetails.ExtPrice} );
cmds.Add( new AcumaticaApiWS.Value { Value = item.ReasonCode, LinkedCommand = SO301000.DocumentDetails.ReasonCode } );
cmds.Add( new AcumaticaApiWS.Value { Value = item.LineDescription, LinkedCommand = SO301000.DocumentDetails.LineDescription } );
cmds.Add( SO301000.Actions.Save );
try
{
    this.context.SO301000Submit( cmds.ToArray() );
}
catch( Exception ex )
{   
    ...
}

It seems to be related to UOM but I'm not sure what the issue is. Thinking that there might be a some configuration somewhere that needs to be setup. But not seeing what it could be.

If I add this line of code right after the new row command, it works fine.

cmds.Add( new AcumaticaApiWS.Value { Value = "EA", LinkedCommand = SO301000.DocumentDetails.UOM } );

However, I would prefer it to get the UOM from the item's inventory default as it was before the update.

Any help would be greatly appreciated.

** Another thought we had was that when we skipped updates by installing just the latest version without installing each of the versions in between we inadvertently caused this issue. - Could that cause weird behavior - skipping updates to just install the latest? Tx

1
what is the behaviour in UI? when u add item, is it auto selecting the UOM?Sin
Also can you try adding a commit = true just after setting the inventory id. cmds.Add( new AcumaticaApiWS.Value { Value = item.InventoryId, LinkedCommand = SO301000.DocumentDetails.InventoryID, commit = true } ); as the error is Inventory id is null while defaulting cury unit cost.Sin
The UI does auto select the UOM and works without issue filling in the exact same fields as code. On the web service though it errors and unfortunately Commit=true does not make a difference. Not sure why putting in the UOM command works without error if error is on curry unit cost.John K.
So if you use any InventoryId you have this issue, not a particular data. You double checked your values passing to the webservice too, rite? Do you have any customizations? Only info available from the stack is that the inventoryID is null when trying process something..Sin
Have checked values. And everything looks ok and the same except update. There are customizations. I'll keep at it tomorrow. Tx.John K.

1 Answers

0
votes

Regarding stack trace you need to set UOM