Specifying Dimension Values for Invoice Lines via the API

Hello,

I’m currently developing a connector that uses the Dynamics 365 Business Central API to share data between D365 BC and my company’s software. For the most part, everything’s gone swimmingly and was pretty straightforward to work with, but I have one major outstanding issue that I can’t quite figure out.

We use the API to create sales and purchase invoices in D365 BC. For both types of invoice, all of our lines are of type “account”; depending on various factors in our system, those lines should be associated with up to two different dimension values. In the UI, it’s trivially easy to go to the invoice lines and set the desired dimension values, but ideally, we’d be able to do this directly via the API at the time of invoice creation. I see nothing in the standard API that allows dimension values to be specified for invoice lines.

I have a feeling that this is possible via some kind of AL extension, but I’m not well versed in AL yet; I was able to expose the “Bill-to Customer No.” field for the “customers” API via a simple AL extension, but when playing around with an extension for the “Sales Invoice Line Entity” page, I see no way to expose the information I’d like, probably because it’s a more complex relationship involving the generating/locating of a dimension set.

I’d prefer to avoid working directly with dimension sets at all, if possible; rather, I’m hoping someone can point me in the right direction for simply being able to send/pull dimension value GUIDs along with my sales/purchase invoice lines (and then, hopefully, D365 BC will handle all of the dimension set shenanigans).

Thanks!

Hi David,

Dimensions in BC seems quite to have an odd design and quite difficult to work with through it’s Dimension Sets. They are not only based on the customer, but also on the dimension from the line account (g/l, item, resource etc.). Plus as you say, it’s easy to change manually from the page. The numbers are generated and are just a unique identifier for a unique combination of dimensions. In BC the user sees dimension “fields” as Global Dimension 1 and 2, but named whatever the names of the dimension are. But if you have more than two dimensions, then you have to use the additional shortcut dimensions 3-7. But these are only visible and editable in a few pages.

So if you only have two dimensions and these are your global 1 and 2, then you should be able to assign values to global dimension 1 and 2 directly. Then upon validating it will update dimension set.

But exactly how to do it with API’s I’m not the best to answer it, as I personally never consumes NAV/BC api’s myself.