Hi,
My colleague has written the following code to try and create a PO via web services. We have published the Purchase Order Page as a service.
void btn_2_Click(object sender, EventArgs e)
{
//Create instance of Purchase Order Service
Nav2009_Service.Purchase_Order_Service service_PO = new Nav2009_Service.Purchase_Order_Service();
service_PO.UseDefaultCredentials = true;
//Create Instance of Purchase Order
Nav2009_Service.Purchase_Order PO = new Nav2009_Service.Purchase_Order();
//Set Purchase Order Properties
PO.Buy_from_Vendor_No = "01587796";
PO.Status = Nav2009_Service.Status.Pending_Approval;
//Create Lines
Nav2009_Service.Purchase_Order_Line po_line = new Nav2009_Service.Purchase_Order_Line();
po_line.No = "LS-S15";
po_line.Quantity = 25;
po_line.Type = Nav2009_Service.Type.Item;
po_line.Description = "Item Description";
//Add the lines to the order
PO.PurchLines = new Nav2009_Service.Purchase_Order_Line[] {po_line};
//Create Purchase Order
service_PO.Create(ref PO);
Response.Write(PO.No);
}
Everything works fine, the item description pulls through in the lines when we validate the item no.
po_line.No = "LS-S15";
However we cannot get the quantity to pull through from this line.
po_line.Quantity = 25;
Should we be doing something differently. My colleague is off for a couple of weeks so I thought I would try here for a resolution.
I have noticed he is setting type last which shoudl INIT the line, but the item no. remains, so this does not seem to be the issue.
Thanks
John
0
Comments
In general, you need to set the associated xxxSpecified property to true when modifying non-string properties. For example,
po_line.Quantity = 25;
po_line.QuantitySpecified = true;
Test Lead
Microsoft Dynamics NAV
This posting is provided "AS IS" with no warranties, and confers no rights.
WIll try this.
Regards
John
What's this property? :oops:
Thanks in advance
Thomas
Test Lead
Microsoft Dynamics NAV
This posting is provided "AS IS" with no warranties, and confers no rights.