I'm trying to add a purchase line to a purchase order in Dynamics NAV (2009 R2 Classic) using web services, but I'm running into a peculiar issue.
Creating a purchase line without defining a No works sans problem. Only when I define a No, like in the example below, I get the following exception:
You cannot enter 'Order' in Integer.
Dim purchaseLine = New PurchaseLine purchaseLine.Document_No = myPurchaseHeader purchaseLine.Document_Type = Document_Type.Order purchaseLine.Document_TypeSpecified = True purchaseLine.Line_No = 1000 purchaseLine.Line_NoSpecified = True purchaseLine.Type = Type.Item purchaseLine.TypeSpecified = True purchaseLine.No = myItemNo ' Defining No seems to cause the problem. purchaseLineService.Create(purchaseLine)
I've tried creating the purchase line first, without defining No. Which works, but updating it with No defined, results in the same.
purchaseLine.No = myItemNo purchaseLineService.Update(purchaseLine)
It was suggested somewhere to try using 1 and "1" for Document_Type, but that didn't work either.
While googling I found some forums where people had a similar problem, but they didn't get me closer to a solution.
Any idea's?
I've also posted this on Stack Overflow.
*This post is locked for comments