使用Acumatica API导出客户的位置

时间:2015-03-23 22:15:55

标签: acumatica

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

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

Locations shown in ERP

调试器显示长度为0的searchResult数组 Locations returned in debugger

1 个答案:

答案 0 :(得分:0)

我尝试了你的例子并且无法使用过滤器来使用它。我稍微修改了它以在搜索命令中传递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)