Options

Page webservice: add orderlines to existing purchase order

BlackBirdBlackBird Member Posts: 52
edited 2010-10-05 in NAV Three Tier
Hi everybody,

I need some (basic?) help on how to make the following work.

I'm trying to add new orderlines to an existing purchase order, but i'm receiving an error when i try to update the order.
I'm using the example of freddyk (http://blogs.msdn.com/b/freddyk/archive ... again.aspx). Each time i'm updating the order i get the message 'Message="Element \"Key\" in namespace \"urn:microsoft-dynamics-schemas/page/inkorder\" is missing from the message!"''. I can't figure out how use the Key in this example. ](*,)

Can someone please correct or give some tips how to make this code work? I published page 50 as a webservice. This is the code i wrote in VS:
PurchOrder_Service service1 = new PurchOrder_Service();
service1.UseDefaultCredentials = true;
PurchOrder order = new PurchOrder();
service1.Read("1", "PO2009-01213");
order.PurchLines = new Purchase_Order_Line[2];
order.PurchLines[1] = new Purchase_Order_Line();
order.PurchLines[1].Type = PurchOrderRef.Type.Item;
order.PurchLines[1].No = "1000";
order.PurchLines[1].Quantity = 1;
service1.Update(ref order); <---- here's the error

Any help is greatly appreciated.

Comments

  • Options
    BlackBirdBlackBird Member Posts: 52
    Really any help :D
  • Options
    companycompany Member Posts: 89
    Hi,

    I have checked the Code you have given there is a mistake in the code see the below change:

    your code :
    service1.Read("1", "PO2009-01213");

    Changed Code:
    order = service1.Read("1", "PO2009-01213");


    please change the code and try.


    thanks
  • Options
    BlackBirdBlackBird Member Posts: 52
    That was it indeed!
    thanks a lot.
Sign In or Register to comment.