NAV Web Service - ReadMultiple with additional Parameters

timhtimh Member Posts: 3
edited 2012-10-25 in NAV Three Tier
Is there any way to pass additional parameters to a ReadMultiple function on a Page type NAV Web Service. I need the parameters in NAV to apply filtering on a related table to the one I am returning as part of the Page. I cannot do this through FlowFields or FlowFilters.

I am not opposed to using an extension codeunit, but I need to call it before the ReadMultiple and therefore I don't have a record instance to pass the Key for and it doesn't like null keys.

I know I could do it with a codeunit function that returns XML, but I would really like for this to return data from a Page Type web service in a single call if possible.

Thanks
tim

Comments

  • agentzagentz Member Posts: 14
    something like this?


    Dim retval As New List(Of hybridObjects.customerConfirmation)

    Dim lstOrders() As SalesHeaderCard
    Dim filters As List(Of SalesHeaderCard_Filter) = New List(Of SalesHeaderCard_Filter)
    Dim filter As SalesHeaderCard_Filter

    'sales header service pointer
    Dim SalesHeaderService As SalesHeaderCard_Service = New SalesHeaderCard_Service

    With SalesHeaderService

    .Url = System.Web.HttpUtility.HtmlEncode(_wsURL & "Page/SalesHeaderCard")
    .UseDefaultCredentials = False
    .Credentials = _creds

    End With

    'set filter values
    filter = New SalesHeaderCard_Filter
    filter.Field = SalesHeaderCard_Fields.Document_Type
    filter.Criteria = paenav.SalesHeaderCard.Document_Type.Order
    'filter.Criteria = Document_Type.Return_Order 'just change to this doc type for ra's
    filters.Add(filter)

    filter = New SalesHeaderCard_Filter
    filter.Field = SalesHeaderCard_Fields.Order_Date
    filter.Criteria = ">=" & orderDate
    filters.Add(filter)

    'try filtering by originatorUserID
    filter = New SalesHeaderCard_Filter
    filter.Field = SalesHeaderCard_Fields.Location_Code
    filter.Criteria = locationCode
    filters.Add(filter)

    lstOrders = SalesHeaderService.ReadMultiple(filters.ToArray(), "", 0)

    If ((lstOrders IsNot Nothing) And (lstOrders.Length > 0)) Then

    For Each shc As SalesHeaderCard In lstOrders

    Dim custConfirmation As New hybridObjects.customerConfirmation

    With custConfirmation

    .po = shc.Your_Reference
    .orderNumber = shc.No
    .orderDate = shc.Order_Date
    .orderStatus = shc.Status.ToString
    .requestedDeliveryDate = shc.Requested_Delivery_Date
    .sellToCust = shc.Sell_to_Customer_Name
    .billToCust = shc.Bill_to_Name
    .orderAmt = shc.Amount
    .blocked = shc.Blocked.ToString

    End With

    retval.Add(custConfirmation)

    Next
    'retval = lstOrders

    End If

    Return retval.ToArray

    Catch ex As Exception

    Return Nothing

    End Try

    End Function
  • timhtimh Member Posts: 3
    Thanks for the reply.

    However, I don't think this helps with my situation.

    What I really need is to return an Item List with Prices based on a Customer No., Customer Price Group and Customer Discount Group.

    What I can't figure out is how to feed the Item Card web service the parameters Customer No., Customer Price Group and Customer Discount Group so that it can use them to calculate the proper Price to include in the returned list of items on a ReadMultiple call.

    Thanks,

    timh
Sign In or Register to comment.