Hi,
I'm importing, via web services, a bunch of historical PurchaseInvoice data into BC from another accounting system. The data has, for whatever reason, many PurchaseInvoice lines where the tax amount is basically manually entered. So that means the imported data can not be setup to use the built-in tax setups in BC.
There is a process in BC to manually override the tax in the user interface:
I'm looking to be able to do this using an AL extension and webservice.
The video shows that ultimately the user is modifying the PurchaseLine.Tax% field. I have verified this by inspecting the page and viewing the PurchaseLine table and seeing the resulting value in the "Tax %" column.
The issue is that the "PurchaseLine.Tax %" field can not be added to the UI (it doesn't show up in the "Purchase Invoice > Lines > then "Help" > Inspect Page > Table Fields listing).
I also tried "Settings > Personalize > Lines > Add Field" but the "Tax%" field does not show up there either.
Similarly, in AL Extension code, creating a new extended card for PurchaseLine2 to show the field for "Tax%" results in a compile error:
Curious thing is that the webservices for PurchaseLines like:
https://api.businesscentral.dynamics.com/v2.0/xxxxxxxx/xxxxxxxxxx/ODataV4/Company('xxxxxxxxxxxx')/BLXPurchaseInvoiceLinesV2(xxxxxxxxxxx)
Shows the "taxPercent" field in the JSON results.
However if you try to post to that endpoint then you get an error:
"'POST' requests for 'BLXPurchaseInvoiceLinesV2' of EdmType 'Entity' are not allowed within Dynamics 365 Business Central OData web services."
So, I'm kinda stuck. The field "Tax %" definitely exists on Purchase Line table. But how can I access it and modify it? Ideally through an AL extension.
Thank you for your help with this.
Thanks!
Alex.