Featured image of post Resolving "Entity doesn't contain attribute with Name = 'transactioncurrencyid'" Errors (Microsoft Dataverse)

Resolving "Entity doesn't contain attribute with Name = 'transactioncurrencyid'" Errors (Microsoft Dataverse)

Deploying a solution in Microsoft Dataverse can often be a scary experience, as you find yourself grappling with all manner of different error messages that could occur at the drop of a hat. As an example, here’s a great one that crept up for me recently:

Message: ‘jjg_myentity’ entity doesn’t contain attribute with Name = ‘transactioncurrencyid’ and NameMapping = ‘Platform’. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=False, IsLoadedInStagedContext = True, Timestamp=15925078, MinActiveRowVersion=15925078, MetadataInstanceId=66519129, LastUpdated=2021-09-01 12:29:08.553Detail:

A bit of context may be helpful at this stage - we had created a table within our environment and added a currency column. When you do this for the first time in Dataverse, the platform will automatically create two additional columns onto the target table:

  • Currency (transactioncurrencyid): Used to record the currency to apply for each row. Typically, this will default to the primary currency specified when creating the Dataverse environment.
  • Exchange Rate (exchangerate): Used to show the conversion rate of the row’s currency, derived from the Currency row selected when creating the table row.

Modifying these fields is generally inadvisable, and, most crucially, it isn’t possible to delete these fields once you’ve added a Currency column to your table for the first time. Therefore, I would recommend only creating a Currency column if you’re 100% certain the business needs it. The reason for this becomes all too apparent when we return to the above error message; in our scenario, we had added and then removed a Currency column to our table. When we deployed our table for the first time, everything worked just fine. When we then tried to deploy again, we started hitting the above error. The presumption is that, because the field exists within our source table, it now expects it to be present within our destination table. However, because no Currency attribute exists on the table, Dataverse doesn’t appear to realise this and create the missing columns for us, hence the above error.

Understanding the circumstances behind the error is all well and good, but how do we resolve it? Attempting to delete the two fields listed above within our source environment is impossible - Microsoft grey out the option in the Maker portal, and we get an error message when attempting to remove it in the “classic” interface:

The only viable course of action is to proceed with adding on a “dummy” Currency row so that Dataverse recognises that these columns need to be created as part of the subsequent import you perform:

Not ideal at all, I agree but provided you clearly label the field and obscure it from any views, forms, etc., the fix is somewhat palatable. Once you’ve added this “dummy” column to your table, you can attempt the solution deployment again, and everything should go green.

Data modelling is an important activity that you should always perform before spinning up the maker portal and creating your columns for the first time. As this example clearly shows, ensuring that you’re 100% confident in your decision to leverage Currency columns will prevent nasty deployment errors like this. Whether this strange behaviour quirk is a bug or not, I’ll leave it up to you to decide. 😉

comments powered by Disqus