使用 Acumatica 为客户导出位置 API

Exporting Locations for a Customer using Acumatica API

我正在尝试使用 Acumatica Web 服务 API 导出客户的所有位置。我希望使用 Locations 屏幕可以在 Customer ID 字段上设置一个过滤器,我认为它是 LocationSummary.Customer,这将使该客户的所有 Locations 都 return。相反,我总是得到 0 个结果 returned。代码如下,我还显示了 ID 为 012349 的测试客户存在的位置的屏幕截图,调试器结果显示 0 条记录 returned.

Public Function GetAddressList(ByVal customerID As String) As String()()
    Dim address As CR303010Content = m_context.CR303010GetSchema()
    m_context.CR303010Clear()

    Dim customerFilter As Filter = New Filter()
    customerFilter.Field = address.LocationSummary.Customer
    customerFilter.Condition = FilterCondition.Equals
    customerFilter.Value = customerID

    Dim searchfilters() As Filter = {customerFilter}
    Dim searchCommands() As Command = {address.LocationSummary.Customer, address.LocationSummary.LocationID, address.GeneralInfoLocationAddress.AddressLine1, address.GeneralInfoLocationAddress.City}
    Dim searchResult As String()() = m_context.CR303010Export(searchCommands, searchfilters, 0, False, False)

    Return searchResult
End Function

调试器显示长度为 0 的 searchResult 数组

我试过你的例子,但无法使用过滤器让它工作。我稍微修改了它以在搜索命令中传递 customerID,并向其添加 ServiceCommands.EveryLocationID 以指定我们希望系统循环遍历所有位置:

    Dim searchCustomer As New Value() With {.Value = customerID, .LinkedCommand = address.LocationSummary.BusinessAccount}
    Dim searchCommands() As Command = {searchCustomer,
                                       address.LocationSummary.ServiceCommands.EveryLocationID, address.LocationSummary.LocationID, address.GeneralInfoLocationAddress.AddressLine1, address.GeneralInfoLocationAddress.City}
    Dim searchResult As String()() = screen.Export(searchCommands, Nothing, 0, False, False)