我想删除一个客户的位置记录。我以前从未删除过任何东西,而且我在 StackOverflow 或 Acumatica 提供的示例中都没有看到任何示例。似乎使用关键字段进行提交和删除命令是有意义的,但这给了我一个非常模糊的“对象引用未设置为对象的实例”。错误。谁能告诉我我在这里做错了什么,或者这是否是错误的方法?下面的代码和完整的错误消息。
Public Function DeleteLocation(ByVal customerID As String, ByVal locID As String) As Boolean
Dim address As CR303010Content = m_context.CR303010GetSchema()
m_context.CR303010Clear()
Dim customerVal As New Value() With {.LinkedCommand = address.LocationSummary.Customer, .Value = customerID}
Dim idVal As New Value() With {.LinkedCommand = address.LocationSummary.LocationID, .Value = locID}
' execute delete
Dim deleteCommands As Command() = {customerVal, idVal, address.Actions.Delete}
Dim deleteResult As CR303010Content() = m_context.CR303010Submit(deleteCommands)
Return True
End Function
抛出此异常:
System.Web.Services.Protocols.SoapException: Server was unable to process request. --->
System.NullReferenceException: Object reference not set to an instance of an object.
at PX.Objects.CR.LocationMaintBase`3.Location_RowDeleted(PXCache cache, PXRowDeletedEventArgs e)
at PX.Data.PXCache.OnRowDeleted(Object item, Boolean externalCall)
at PX.Data.PXCache`1.Delete(Object data, Boolean bypassinterceptor)
at PX.Data.PXCache`1.Delete(Object data, Boolean bypassinterceptor)
at PX.Data.PXCache`1.Delete(Object data)
at PX.Data.PXDelete`1.<Handler>d__0.MoveNext()
at PX.Data.PXAction`1.<Press>d__c.MoveNext()
at PX.Data.PXAction`1.<Press>d__c.MoveNext()
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)
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 ---