I am trying to post an invoice for a purchase order that has been received. I am trying to achieve this through web services or odata services. I would like to know how we can use the codeunit 90/91 to achieve this job? Is it even possible as I am unable to see where i can pass which PO number to post invoice over codeunit 90 web service.
Secondly, the other way I was am trying is to use the "Purchase Invoice 51" to directly create an invoice however from front end we can associate receipts with that purchase invoice but through this service I am unable to find a way to associate receipts with the purchase invoice.
Any help would be great!
Even if you in theory just could publish codeunit 90, then it would not work. The problem is that it it has build in user dialog, which would not work via web services.
My suggestion would be to build a new codeunit, which calls codeunit 90 with the parameters required. This way you can much better control what it is doing.
You can see a previous question about almost the same here:
But which version of NAV is this? They have done some improvements in the web services area, that's the functionality they use to allow you to post an invoice from office 365.
Thanks for your response, will check this out and update here.
We are using Nav 2016.
Well, as far as I remember, then these new improved services came in NAV 2017. And now with NAV 2018 you also have CDS (common data services).
But you should have codeunit 98. That's the codeunit used by the job queue, to automatically post purchase invoices. In order for that to work, then notice the EnqueuePurchDoc function. With that and the thread above, then it shouldn't be that difficult to make a new codeunit to post via web service.