Use case: I had to set financial dimension values for Purchase Order Lines using oData while inserting data into D365 Unified Operations.
To set the financial dimensions, we need to set the value for the field “DefaultLedgerDimensionDisplayValue“. When I tried to set the value, I got the following error.
Write failed for table row of type ‘PurchPurchaseOrderLineEntity’. Infolog: Error: The number of dimension values specified in XXXX is different from the number set up in the active format for data entities.Things to try: • Make sure the number of dimension values specified matches the active format for data entities. • Make sure that any dimension values specified that include the chart of accounts delimiter character in the name escape the delimiter character with a backslash character ‘\’.; Error: Error found when validating record..
So the error seems to be related to settings for Dimensions in Dynamics 365 UO. So just to confirm this I have manually set the Dimension values and retrieved that record using OData. I found out that that dimension value was empty in the JSON.
Req :https://XXX.sandbox.operations.dynamics.com/data/PurchaseOrderHeadersV2?$filter=PurchaseOrderNumber%20eq%20%27XXXXX%27&$top=2 and the value for the field DefaultLedgerDimensionDisplayValue was empty : “DefaultLedgerDimensionDisplayValue”: “”,
This confirmed that the settings for Dimension values are not correctly set in D365UO. In D365UO, there are separate Dimension settings for integration. This can be found in General ledger > Chart of accounts > Dimensions > Financial dimension configuration for integrating applications
Then I added a “Default dimension format” dimension settings for oData data import. I clicked Add, then gave the “Name of the dimension format”, selected “Default dimension format”, and Set Yes for “Active form type”. Then added the financial dimensions needed, which would give the format I should use in my oData call.
The Financial dimension format for my use case was ContractHeader|ContractNumber|Crop|Producer|QualityCode|Partnercode . The delimiter for the dimension values is |. The delimiter character can be changed in D365 FO in the page General ledger>Ledger setup>General ledger parameters under Chart of accounts and dimensions tab
So let us say we need to fill in only ContrctHeader and ContractNumber for the use case, then the value should be filled in as 0001|0200|||| for the oData call. What it means is that we always have to stick to the dimension format even when no values are needed to be filled for that dimension. So the following examples
- When ContractHeader, ContractNumber, Partnercode values need to be filled then 0001|0200||||4555
- When Crop, Producer, QualityCode, Partnercode values need to be filled then ||Onion|33445|HQ|4555
Then I submitted my oData call and which was successfully executed. The output was of the oData call showed the correct dimension value.