Solved

The system failed to commit the Transactions row.

  • 20 September 2023
  • 4 replies
  • 188 views

Userlevel 6
Badge +3

Hi Team,

I Have a very simple customization where inserting one line item programmatically on Order Qty Field Updated event.
Acumatica version : 21.208.0032

From screen level it is Inserting new line item and working as expected. While trying to create order from Postman facing the below error.

{
    "message""An error has occurred.",
    "exceptionMessage""Operation failed",
    "exceptionType""PX.Data.PXInvalidOperationException",
    "stackTrace""   at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()",
    "innerException": {
        "message""An error has occurred.",
        "exceptionMessage""The system failed to commit the Transactions row.",
        "exceptionType""PX.Data.PXException",
        "stackTrace""   at PX.Api.SyImportProcessor.SyStep.CommitChangesInt(Object itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction, SyImportRowResult importResult)\r\n   at PX.Api.SyImportProcessor.SyStep.CommitChanges(Object& itemToBypass, PXFilterRow[] targetConditions, PXFilterRow[] filtersForAction)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()"
    }
}

Here is the Code that i have implemented.

protected virtual void SOLine_OrderQty_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated BaseUpdatedevent)
        {
            if (BaseUpdatedevent != null)
            {
                BaseUpdatedevent(cache, e);
            }
            SOLine rows = (SOLine)e.Row;
            if ((Base.Document.Current.Status == "N" || Base.Document.Current.Status == "H" || Base.Document.Current.Status == "B" || Base.Document.Current.Status == "P") && rows.OrderQty > 0.0m)

            {
                if (rows.InventoryID != 10251)
                {

                    SOLine objv = (SOLine)Base.Transactions.Cache.Insert();
                    objv.InventoryID = 10251;
                    objv.IsFree = true;
                    objv.ManualDisc = true;
                    objv.OrderQty = 1;
                    Base.Transactions.Cache.Update(objv);
                    Base.Transactions.View.RequestRefresh();
                }

            }
        }
Postman Request :

{
    "OrderNbr": {
        "value""<NEW>"
    },
    "OrderType": {
        "value""SO"
    },
    "CustomerID": {
        "value""AACUSTOMER"
    },
    "Details": [
        {
            "InventoryID": {
                "value""PROD01"
            },
            "OrderQty": {
                "value""1.0000"
            }
        }
    ]
}



Thanks in Advance

icon

Best answer by Vignesh Ponnusamy 27 September 2023, 22:59

View original

4 replies

Userlevel 7
Badge +4

Hi @praveenpo,

I wasn’t able to reproduce the issue in my local(in 23R109). Try an IIS reset or in a different instance, if the issue still persists, share the customization package or more details that might help to replicate the error.

Userlevel 6
Badge +3

hi @Vignesh Ponnusamy,

We are having this issue in the version 21.208 0032.


 

Userlevel 7
Badge +4

Hi @praveenpo,

Yes, I was able to reproduce the issue in 21.209 but couldn’t narrow down to the root cause of the issue.

I was able to get it working with the RowUpdated event, you could try it to see if that could help,

        protected void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (SOLine)e.Row;
if ((Base.Document.Current.Status == "N" || Base.Document.Current.Status == "H" || Base.Document.Current.Status == "B" || Base.Document.Current.Status == "P") && row.OrderQty > 0.0m )
{
if (row.InventoryID != 311)
{

SOLine objv = new SOLine();
objv.InventoryID = 311;
objv.IsFree = true;
objv.ManualDisc = true;
objv.OrderQty = 1;
Base.Transactions.Cache.Update(objv);
Base.Transactions.View.RequestRefresh();
}
}

}

You can set a valid InventoryID that is available in your instance. Good Luck.!

Userlevel 6
Badge +3

hi @Vignesh Ponnusamy ,

Thanks for the suggestion, We will move to Row updated event  and verify.

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved