Hi All
I am working on a solution for writing Sales/Purchase Documents from Excel into Business Central. I can create the Sales/Purchase Headers and their related Sales/Purchase Lines but I am finding that the Document Date that I sending to the API page is reverted to the current date when I look at the record in Sales Order/Invoices web page. It accepts the Posting Date and this appears in BC, it must be using the Excel uploaded Document Date because it calculates the Due Date correctly based on the Excel value but it writes the current date to the Document Date.
Looking at the Sale Header table definition I can see their is an InitRecord() procedure that sets the "Order Date" and "Document Date" to the WorkDate which makes me think that when the Sales Header is created, it defaults these dates to current date. Once the Sales Header is created, I can run a PATCH (update) on the record and change the Document Date and Due Date. I would like to avoid the two step process of inserting the headers and then updating just the dates, I have tried changing my Sales Header API page but I can't seem to find the pattern that will allow me to use the uploaded Document Date.
Any suggestions would be appreciate.