0
votes

The program creates a Bill in Acumatica using SOAP. The Endpoint was extended to include InventoryID, WSDL generated. The program uses the extended Endpoint to read and write all info. Reading InventoryID on non-Stock items works fine.

Populating Bill Details with the fields other than InventoryID also works fine:

                        loBillDetails[lnCurIndex + I1] = new BillDetail
                        {
                            // InventoryID = new StringValue { Value = lcInventoryID },
                            Branch = new StringValue { Value = lcBranch },
                            Amount = new DecimalValue { Value = lnLineExtAmt },
                            ExtendedCost = new DecimalValue { Value = lnLineExtAmt },
                            UnitCost = new DecimalValue { Value = 0 },
                            Qty = new DecimalValue { Value = 0 },
                            TransactionDescription = new StringValue { Value = lcTranDesc },
                            UOM = new StringValue { Value = lcUOM },
                            Account = new StringValue { Value = lcAccount },
                            Subaccount = new StringValue { Value = lcSubAccount },
                            Description = new StringValue { Value = lcItemDesc },
                        };

However, including InventoryID causes the Bill insert to fail, with an error message below. I checked that the value provided to InventoryID is correct.

Do I need to provide any additional fields to the Bill that I am inserting? What might be the issue here?

PX.Data.PXInvalidOperationException: Operation failed ---> PX.Data.PXBadDictinaryException: The key cannot be updated at this time. Try to save your previous changes first.\n at PX.Data.PXCache1.Update(IDictionary keys, IDictionary values)\n at PX.Data.PXGraph.ExecuteUpdate(String viewName, IDictionary keys, IDictionary values, Object[] parameters)\n at PX.Data.PXGraph.CopyPasteCommitChanges(String viewName, OrderedDictionary keys, OrderedDictionary vals)\n at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2)\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()\n --- End of inner exception stack trace ---\n at PX.Api.ContractBased.Soap.WebApiSoapController.Post(ISoapSystemContract systemContract, XmlReader requestReader, String serviceNamespace, String internalNamespace, MethodInfo method, Func1 serviceFactory, IEdmModel edmModel)\n at PX.Api.ContractBased.Soap.WebApiSoapController.d__8.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at PX.Api.ContractBased.Soap.WebApiSoapController.d__6.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Threading.Tasks.TaskHelpersExtensions.d__3`1.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\n--- End of stack trace from previous location where except ion was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()" Exception thrown: 'System.ServiceModel.FaultException' in mscorlib.dll

Thank you. Alexander

1
Hi Alexander, Did you try to save with all of the other fields, and then populate the InventoryID and save again? (I understand 2 saves is not ideal).Diane Cawley
Hi Diane, thank you for your desire to help. I've just received an answer, please see below.Alexander

1 Answers

1
votes

Sergey Marenich offered a solution: migrate to endpoint 18.200.001 from 17.200.001 that I was using, because 18.200.001 already includes InventoryID.

He also found an issue with the mapping used to extending the endpoint: I mapped the new column to InventoryID->InventoryID, instead of just InventoryID.

I migrated to 18.200.001, and that solved the issue.