SalesOrder.SalesOrder_Service SOService = new SalesOrder.SalesOrder_Service(); SOService.UseDefaultCredentials = true; // Create the Order header SalesOrder.SalesOrder newOrder = new SalesOrder.SalesOrder(); SOService.Create(ref newOrder); // Update Order header newOrder.Sell_to_Customer_No = "10000"; // Create Order lines newOrder.SalesLines = new Sales_Order_Line[2]; for (int idx = 0; idx < 2; idx++) newOrder.SalesLines[idx] = new Sales_Order_Line(); SOService.Update(ref newOrder);
Comments
Try with below sample code.
Best Regards,
Yukon
But still no SalesLines method available, could it be a problem with the SalesOrder page i NAV ?
If there is Custom Code in the page, could that make it corrupt ?
/Anders
/Anders
After adding the Web Reference in the application you will have a Webrefernece suppose
say i have added it as salesorder
SalesOrder.Sales_Order_Line will give the information regarding the sales lines.
Hope this is what you are looking..
from your code i see that tis is what you have writeen
newOrder.SalesLines = new Sales_Order_Line[2];
but it should be declared as
NewOrder.Sales_Order_Line ss = new Sales_Order_Line();
Problem is still that intellisense in vs does not give me the method "SalesLines" or "Sales_Order_Line".
I think problem lays somewhere else, but just can't figure it out.
Does any one have a codesnippet from vs2008/2010 C# that gives the method ?
/Anders
See attached photo.
I thought your problem is solved.
Regards,
Yukon
This is the standard page i am testing against at the moment.
/Anders
After import your page into my db, it's ok for me. i can see Sales Line Method. I don't know what happen on your PC. Please try this way,
Remove ws from your project and delete link from appconfig or webconfig. After that add ref. again.
Noted: i tested on NAV R2 B302012. I created new page for sales header and sales line. I face error when i used one page. That's why i decide to use separate page.
Best Regards,
Yukon
Is the page42 dependent of any other object ?
I am not shure of what you meen by your note with 2 seperate pages.
I'm running r2 build 32012.
/Anders