Friday, November 12, 2010

Dynamic Navision Sales Order Integration - Sales Order header Already Exists

We had a requirement to integrate sales orders from third party system into Dynamics NAV 2009 SP1 using Sales Order page from web services in NAV2009. It worked Fine in our local Environment.

Trouble started when we deployed our App on Client Environment, it started throwing an error: "The Sales Header already exists. Identification fields and values: Document Type='Order',No.='2001'" though Order number does not exists in Dynamics NAV.

After Scratching our head for a while and thanks to Freddy, we found his blog and solution worked for us and saved a great deal of time.
http://blogs.msdn.com/b/freddyk/archive/2009/05/28/handling-sales-orders-from-page-based-web-services-in-nav-2009sp1-and-rtm.aspx

His solution was to mimic how Role Tailored Client Works to Insert a new order.
which is also MS recommendation on this issue.
1. Create the Order Header
2. Update the Order Header
3. Create an Order Line
4. Update an Order Line
(repeat steps 3-4)

you can find some sample code as well in his blog.

No comments:

Post a Comment