1
votes

I'm trying to use the Acumatica Web Services API to export all Locations for a Customer. I would expect that using the Locations screen I could set a filter on the Customer ID field, which I think is LocationSummary.Customer, and that would return me all Locations for that customer. Instead, I'm always getting 0 results returned. Code is below, and I've also shown a screen shot of the Locations that exist for a test customer with ID 012349, and the debugger results showing 0 records 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

Locations shown in ERP

Debugger showing searchResult array with a length of 0 Locations returned in debugger

1
I'd provide another approach. You can create your own Generic Inquiry and collect all required data there and then using Web Services with your own screen export/filter data. - srodionov

1 Answers

0
votes

I tried your example and couldn't get it to work using filters. I modified it slightly to pass the customerID in the search commands instead, and to add ServiceCommands.EveryLocationID to it to specify that we want system to loop through all locations:

    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)