Search code examples
acumatica

Error updating existing record in Acumatica using API PUT


I'm running into a NullReference error while trying to update an existing stock item using a PUT API call + json dict of the stock item:

https://.../entity/Default/18.200.001/StockItem?$filter=InventoryID eq '010343914117'

Instead of updating the record, I'm getting this error 500 response:

{
    "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, ...",
    "innerException": {
        "message": "An error has occurred.",
        "exceptionMessage": "Object reference not set to an instance of an object.",
        "exceptionType": "System.NullReferenceException",
        "stackTrace": "   at KN.CP.KNCPInventoryItemMaintExt.InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseSelectedevent)\r\n   at KN.DistrictCameras.KNDCInventoryItemMaintBaseExt.InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseEvent)\r\n   at KN.S3Images.KNCPInventoryItemMaintS3Ext.InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseSelectedevent)\r\n   at KNCommerceBasic.KNCBInventoryItemMaintExt.InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseEvent)\r\n   at KNMagentoConnector.KNMCInventoryItemMaintExtn.InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected BaseEvent)\r\n   at PX.Data.PXRowSelected.Invoke(PXCache sender, PXRowSelectedEventArgs e)\r\n   at PX.Data.PXCache.OnRowSelected(Object item)\r\n   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()"
    }
}

If I do the same request as a GET instead, it successfully retrieves the record. So why does the PUT update not work?


Solution

  • It looks like there is a customization to the InventoryItem Maintenance graph,KNCPInventoryItemMaintExt, that is triggering the error. You may need to run that down with the author.