1

Need to use the create method of the AX 2009 ReturnOrderInService web service in a vb.NET aspx page to create an RMA in AX.

The code I've written below creates the RMA in AX, but doesn't show the line details in the AX RMA form, even though the records are in SalesTable and SalesLine.

Is a record needed in InventTrans or is there a missing InventRefId value somewhere?


    Dim rmaClient As ReturnOrderInServiceClient = New ReturnOrderInServiceClient("WSHttpBinding_ReturnOrderInService1")
    Dim roi As AxdReturnOrderIn = New AxdReturnOrderIn

    Dim st As AxdEntity_SalesTable = New AxdEntity_SalesTable
    st.CustAccount = "123"
    st.ReturnReasonCodeId = "RRC1"
    st.DlvMode = "01"
    st.SalesType = 4  'return item
    st.ReturnDeadline = DateAdd(DateInterval.Day, 15, Now())

    Dim sl As AxdEntity_SalesLine = New AxdEntity_SalesLine
    sl.ItemId = "ITEM 123"        
    sl.ExpectedRetQty = -2
    sl.LineAmount = 0           
    sl.InventTransIdReturn = "" 

    st.SalesLine = New AxdEntity_SalesLine() {sl}
    roi.SalesTable = New AxdEntity_SalesTable() {st}

    txtFeedback.Text = ""

    Try
        Dim returnedSalesOrderEntityKey As EntityKey() = rmaClient.create(roi)
        Dim returnedSalesOrder As EntityKey = CType(returnedSalesOrderEntityKey.GetValue(0), EntityKey)            
        txtFeedback.Text = GetRMANo(returnedSalesOrder.KeyData(0).Value)
    Catch ex As Exception
        txtFeedback.Text = ex.Message
    End Try

    rmaClient.Close()
Don
  • 49
  • 3
  • 10
  • Could you be more specific on your goals and means? – Jan B. Kjeldsen Jul 25 '11 at 09:11
  • The goal is to be able to initiate/create an RMA order in AX2009 using an aspx page on the web (written in vb.net). I have an example on creating a sales order (in C#, not VB), but cannot find an example for creating an RMA. Cannot quite get all the C# syntax to translate into VB and make it work. – Don Jul 25 '11 at 15:57
  • Could you link to the sales order example? Could you explain what C# syntax do not translate to VB? – Jan B. Kjeldsen Jul 26 '11 at 10:42
  • Jan, the MSDN link below shows the SO example. When creating an RMA, I'm unclear which AxdEntity objects need to be created and passed to the ReturnOrderInServiceClient object, and syntactically how to do this in vb.net. http://msdn.microsoft.com/en-us/library/ff628055(v=ax.50).aspx – Don Jul 26 '11 at 16:44

1 Answers1

0

Did you generate the proxy classes as stated in http://msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx? This should create the AxdEntity classes needed.

First I would try to translate the example to VB. I cannot help you with the specific syntax, but there is nothing fancy here, so it should be rather simple.

Regarding the use of web services in AX, see also:

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50