1
votes

We had webservice integration and it was working all the way, but suddenly it started to throw the below error when creating a RC type order. Dont understand what exactly is going wrong. We didnt update anything so i believe this is some data related issue.

I tried the same process via UI and it is not giving this error. Please assist. Your help is deeply appreciated.

PX.Data.PXRowPersistingException: Error #4: 'RevisionID' cannot be empty.

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> PX.Data.PXRowPersistingException: Error #4: 'RevisionID' cannot be empty. at PX.Data.PXDefaultAttribute.RowPersisting(PXCache sender, PXRowPersistingEventArgs e) at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation) at PX.Data.PXCache1.PersistInserted(Object row) at PX.Objects.CS.SharedRecordAttribute.RowPersisting(PXCache sender, PXRowPersistingEventArgs e) at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation) at PX.Data.PXCache1.PersistInserted(Object row) at PX.Data.PXCache1.Persist(PXDBOperation operation) at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation) at PX.Data.PXGraph.Persist() at PX.Objects.SO.SOShipmentEntry.Persist() at PX.Data.PXSave1.d__2.MoveNext() at PX.Data.PXAction1.<Press>d__31.MoveNext() at PX.Data.PXAction1.d__31.MoveNext() at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2) 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, Dictionary2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable
1 commands, SchemaMode schemaMode, Boolean mobile, PXGraph& forceGraph, String& redirectContainerView, String& redirectScreen, Dictionary2 viewFilters) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable1 commands, SchemaMode schemaMode) at PX.Api.Soap.Screen.ScreenGate.Submit(Command[] commands)

--- End of inner exception stack trace ---

EDIT

The autonumbering is enabled for this order type and the code is as below. Acumatica version 6.00.1384

As mentioned before, this code was working correctly. suddenly the behavior changed and i dont know what is the reason.

    apitest.Screen context = BuisnessLogicACU.context;
                        SO301000Content SOSchema;

                        try
                        {
                            SOSchema = context.SO301000GetSchema();
                        }
                        catch
                        {
                            BuisnessLogicACU.contextLogin();
                            SOSchema = context.SO301000GetSchema();
                        }              
                        SOSchema.Actions.LSSOLineBinLotSerial.Commit = true;
                        SOSchema.Actions.CreateReceiptAction.Commit = true;

                        //HEADER INFO
                        AcumaticaInterface.apitest.Command[] commands = new AcumaticaInterface.apitest.Command[]
                    {
                        new Value
                        {
                            Value = returnInterfaceStatus.SalesOrderType,
                            LinkedCommand = SOSchema.OrderSummary.OrderType
                        },
                        SOSchema.Actions.Insert,

                        new Value 
                        {
                            Value = "false", 
                            LinkedCommand = SOSchema.OrderSummary.Hold
                        },
                        new Value 
                        {
                            Value = OrderStatus == POSOrderstatus.Normal ? (ConfigValues.POSNormalCustomerID ?? CustomerID) : CustomerID,  
                            LinkedCommand = SOSchema.OrderSummary.Customer
                        },
                        new Value 
                        {
                            Value = BizDate.HasValue ? ((DateTime)BizDate).ToLongDateString() : "", 
                            LinkedCommand = SOSchema.OrderSummary.Date
                        },
                        new Value 
                        {
                            Value = BizDate.HasValue ? ((DateTime)BizDate.Value).ToLongDateString() : "", 
                            LinkedCommand = SOSchema.OrderSummary.RequestedOn
                        },                   
                        new Value 
                        {
                            Value = POSID, 
                            LinkedCommand = SOSchema.OrderSummary.ExternalReference
                        },                
                        new Value 
                        {
                            Value = SIPosOrdrCreatedBy, 
                            LinkedCommand = SOSchema.OrderSummary.POSOrdrBy
                        },                
                        new Value 
                        {
                            Value = CustomerTaxZone, 
                            LinkedCommand = SOSchema.FinancialSettingsFinancialInformation.CustomerTaxZone
                        }
                    };

     AcumaticaInterface.apitest.Command[] commandline = new AcumaticaInterface.apitest.Command[]
                                {
                                 SOSchema.DocumentDetails.ServiceCommands.NewRow,
                                new Value 
                                {
                                    Value = line.InventoryID, 
                                    LinkedCommand = SOSchema.DocumentDetails.InventoryID 
                                },
                                new Value 
                                {
                                    Value = SIOutletCode, 
                                    LinkedCommand = SOSchema.DocumentDetails.Warehouse
                                },
                                new Value 
                                {
                                    Value = line.Quantity.ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.Quantity,
                                    Commit = true
                                },                         
                                new Value 
                                {
                                    Value = line.UnitPrice.ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.UnitPrice
                                },
                                new Value 
                                {
                                    Value = line.Uom, 
                                    LinkedCommand = SOSchema.DocumentDetails.UOM
                                },
                                new Value 
                                {
                                    Value = (line.DiscTotal ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.DiscountAmount
                                },
                                  new Value 
                                {
                                    Value = (line.LineTotal ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.ExtPrice
                                },
                                new Value 
                                {
                                    Value = line.DiscType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSDiscType
                                },
                                new Value 
                                {
                                    Value = line.LineType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSLineType
                                },
                                new Value 
                                {
                                    Value = line.VoucherSerial ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSVoucherSerial
                                },
                                new Value 
                                {
                                    Value = line.PromoID ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoID
                                },
                                new Value 
                                {
                                    Value = line.PromoType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoType
                                },
                                new Value 
                                {
                                    Value = (line.PromoPct ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoPct
                                },
                                new Value 
                                {
                                    Value = line.PromoBaseItem ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoBaseItem
                                },
                                //new Value 
                                //{
                                //    Value = SalesPerson, 
                                //    LinkedCommand = SOSchema.DocumentDetails.SalespersonID
                                //},
                                new Value 
                                {
                                    Value = line.Remarks ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.NoteText,
                                    Commit = true 
                                },
                                 new Value 
                                {
                                    Value = POSID,
                                    LinkedCommand = SOSchema.DocumentDetails.PackUoM,
                                    Commit = true 
                                }
                            };
                            commands = commands.Concat(commandline).ToArray();

  AcumaticaInterface.apitest.Command[] save = new AcumaticaInterface.apitest.Command[] {
                        SOSchema.Actions.Save                       
                    };
                    commands = commands.Concat(save).ToArray();
  AcumaticaInterface.apitest.Command[] returnResult= new AcumaticaInterface.apitest.Command[] {                 
                SOSchema.OrderSummary.OrderType,
                SOSchema.OrderSummary.OrderNbr,
                SOSchema.OrderSummary.Status
            };
                commands = commands.Concat(returnResult).ToArray();

                var SOrder = context.SO301000Submit(commands)[0];
1
Can you please provide with Acumatica version and the commands that you are using in the Screen API call? - samol518
Can you please provide your code as well? It can be good if you can create minimal code that can reproduce your issue - Yuriy Zaletskyy
please see the updated question. - Sin
any assistance? - Sin
In my updated answer below is the closest set of SOAP commands that can be run on brand new 6.00.1384 website with only Sales Demo deployed. And it runs without any issues. Not sure how to reproduce reported issue on local machine without exact steps from you. - RuslanDev

1 Answers

1
votes

I've seen this error message several times so far and usually it was caused by incorrect set of API commands resulting in update of existing Transfer order instead of creating of a new one.

Make sure you pass Insert action after you set OrderType to TR, if autonumbering is enabled for Numbering Sequence of the TR order type:

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/StackOverflow/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content salesOrderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderType,
            Value = "TR"
        },
        salesOrderSchema.Actions.Insert,
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.DestinationWarehouse,
            Value = "RETAIL"
        },
        salesOrderSchema.Actions.Save,
        salesOrderSchema.OrderSummary.OrderNbr
    };
    var transferOrder = context.Submit(commands);
}
finally
{
    context.Logout();
}

Or, if autonumbering is disabled for Numbering Sequence of the TR order type, you should set OrderNumber instead of the Insert action:

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/StackOverflow/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content salesOrderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderType,
            Value = "TR"
        },
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderNbr,
            Value = "NEWNUMBER"
        },
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.DestinationWarehouse,
            Value = "RETAIL"
        },
        salesOrderSchema.Actions.Save,
        salesOrderSchema.OrderSummary.OrderNbr
    };
    var transferOrder = context.Submit(commands);
}
finally
{
    context.Logout();
}

Below is the closest set of SOAP commands that I was able to run on brand new 6.00.1384 website with only Sales Demo deployed. And it runs without any issues. Not sure how to reproduce reported issue on local machine without exact steps from you.

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/SOReturn/Soap/SO301000.asmx";
context.Login(Login, Password);

var SOSchema = context.GetSchema();

SOSchema.Actions.LSSOLineBinLotSerial.Commit = true;
SOSchema.Actions.CreateReceiptAction.Commit = true;

//HEADER INFO
var headerCommands = new Command[]
{
    new Value
    {
        Value = "RC",
        LinkedCommand = SOSchema.OrderSummary.OrderType
    },
    SOSchema.Actions.Insert,

    new Value
    {
        Value = "false",
        LinkedCommand = SOSchema.OrderSummary.Hold
    },
    new Value
    {
        Value = "ABARTENDE",
        LinkedCommand = SOSchema.OrderSummary.Customer
    },
    //new Value
    //{
    //    Value = BizDate.HasValue ? ((DateTime)BizDate).ToLongDateString() : "",
    //    LinkedCommand = SOSchema.OrderSummary.Date
    //},
    //new Value
    //{
    //    Value = BizDate.HasValue ? ((DateTime)BizDate.Value).ToLongDateString() : "",
    //    LinkedCommand = SOSchema.OrderSummary.RequestedOn
    //},
    new Value
    {
        Value = "TEST",
        LinkedCommand = SOSchema.OrderSummary.ExternalReference
    },
    //new Value
    //{
    //    Value = SIPosOrdrCreatedBy,
    //    LinkedCommand = SOSchema.OrderSummary.POSOrdrBy
    //},
    //new Value
    //{
    //    Value = CustomerTaxZone,
    //    LinkedCommand = SOSchema.FinancialSettingsFinancialInformation.CustomerTaxZone
    //}
};

var commandline = new Command[]
{
    SOSchema.DocumentDetails.ServiceCommands.NewRow,

    new Value
    {
        Value = "AACOMPUT01",
        LinkedCommand = SOSchema.DocumentDetails.InventoryID
    },
    new Value
    {
        Value = "WHOLESALE",
        LinkedCommand = SOSchema.DocumentDetails.Warehouse
    },
    new Value
    {
        Value = "10.0",
        LinkedCommand = SOSchema.DocumentDetails.Quantity,
        Commit = true
    },
    new Value
    {
        Value = "234.01",
        LinkedCommand = SOSchema.DocumentDetails.UnitPrice
    },
    new Value
    {
        Value = "EA",
        LinkedCommand = SOSchema.DocumentDetails.UOM
    },
    new Value
    {
        Value = "50.0",
        LinkedCommand = SOSchema.DocumentDetails.DiscountAmount
    },
    new Value
    {
        Value = "4500.00",
        LinkedCommand = SOSchema.DocumentDetails.ExtPrice,
        Commit = true
    },
    //new Value
    //{
    //    Value = line.DiscType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSDiscType
    //},
    //new Value
    //{
    //    Value = line.LineType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSLineType
    //},
    //new Value
    //{
    //    Value = line.VoucherSerial ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSVoucherSerial
    //},
    //new Value
    //{
    //    Value = line.PromoID ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoID
    //},
    //new Value
    //{
    //    Value = line.PromoType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoType
    //},
    //new Value
    //{
    //    Value = (line.PromoPct ?? 0).ToString(),
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoPct
    //},
    //new Value
    //{
    //    Value = line.PromoBaseItem ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoBaseItem
    //},
    new Value
    {
        Value = "Remarks",
        LinkedCommand = SOSchema.DocumentDetails.NoteText,
        Commit = true
    },
    //new Value
    //{
    //    Value = POSID,
    //    LinkedCommand = SOSchema.DocumentDetails.PackUoM,
    //    Commit = true
    //}
};

var commands = headerCommands.Concat(commandline).ToArray();

Command[] save = new Command[] 
{
    SOSchema.Actions.Save
};
commands = commands.Concat(save).ToArray();
Command[] returnResult = new Command[] 
{
    SOSchema.OrderSummary.OrderType,
    SOSchema.OrderSummary.OrderNbr,
    SOSchema.OrderSummary.Status
};
commands = commands.Concat(returnResult).ToArray();

var SOrder = context.Submit(commands)[0];