My entities are missing…

One of the crucial concepts in Dynamics 365 for Operations are Data Entities… you use them for basically everything. Data entities is an abstraction on top of the regular database table which aggregates multiple table into one object.

Today I had a problem with an entity missing som the entity list. I this happens the solution is usually to refresh the list by going to  System administration – Workspaces – Data management – Data import/export framework parameters and clicking Refresh entity list under Entity Settings.

That did not do the trick today so I had to dig deeper… and found this SQL script that clears the entity list:

-- This source code or script is freeware and is provided on an “as is” basis without warranties of any kind,
-- whether express or implied, including without limitation warranties that the code is free of defect,
-- fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of
-- the code is with the end user.

-- Create backups of the tables first

INTO DMFEntity_backup

INTO DMFTargetXML_backup

INTO DMFTargetXMLToEntityMap_backup
FROM DMFTargetXMLToEntityMap

INTO DMFTargetEntityHierarchy_backup
FROM DMFTargetEntityHierarchy

-- Truncate the tables



TRUNCATE TABLE DMFTargetEntityHierarchy

Then I go back to Data import/export framework parameters and run Refresh entity list.

That seem to do the trick

NOTE: this procedure has one slight down side and that you are also deleting all mappings for all entities. The (rather tedious) solution is to go into each entity and regenerate mappings… for all 2800+ entities… Wohoo…

Fortunately a smart person on Yammer wrote this script that regenerates all mappings for all entities in one run.


Setting up PowerBI embedded and Analytical workspaces in Dynamics 365 for Finance and Operations in a OneBox Environment

One of the cool features in Dynamics 365 for Finance and Operation are Analytical workspaces which enables Dynamics to display PowerBI workspaces inside of the Dynamics UI which also means that you are able to use the included limited PowerBI license that comes with D365fO

To get this working you can either deploy the includes report packages which are downloadable from LCS or you can create your own and upload them to LCS. There is however some infrastructure required to get this up and running  because the report get their data from aggregetad measurements, which you are required to create.

The measurements are syncronized to the AxDW database and the report uses Direct Query to read the data. Since the report reads its data from the AxDW database it does not have the ferformance implications that OData has.

The process for setting this up in a Tier-2 and up environment is pretty straight forward since these all include the specific service for hosting the PowerBI report but in Tier-1 (OneBox) this service is not present and this means that we will have to do a slight workaround.

First we have to create an Azure Service for hosting the report, you will find the detils in this link

The next step is to copy the AxDW database from the environment to Azure SQL. You find the information here and here.

And the last part is to reconfigure the OneBox environment to use the Azure SQL hosted entity store instead of the internal

I only had one minor issue diring the setup… the AxDW admin user was not able to log in to the AxDW database in Azure SQL resulting in this message:

I resolved it by deleting and recreating the user :

CREATE LOGIN [axdwadmin] 
WITH PASSWORD = 'axdwpassword'

CREATE USER [axdwadmin] 
FOR LOGIN [axdwadmin] 

ALTER ROLE db_datareader ADD MEMBER [axdwadmin]; 
ALTER ROLE db_datawriter ADD MEMBER [axdwadmin]; 
ALTER ROLE db_owner ADD MEMBER [axdwadmin];


Setting a Dynamic 365 for Operations cloud hosted environment in Maintenance mode

Some configurations in Dynamics requires you to be in Maintenance Mode. Some of these are:

  • Activating dimensions
  • Changing license keys

The limitations of maintenance mode is that you will need to be Admin or maintenance mode user to log in.

  1. Log into the VM using RDP
  2. Start an elevated command prompt
  3. Go to K:\AosService\PackagesLocalDirectory\Bin\ (in this case K is the service volume)
  4. För följande:
    Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir K:\AosService\PackagesLocalDirectory --bindir K:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser  --sqlpwd [sqlpassword] --setupmode maintenancemode --isinmaintenancemode true

To set it back run this

Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir K:\AosService\PackagesLocalDirectory --bindir K:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser  --sqlpwd [sqlpassword] --setupmode maintenancemode --isinmaintenancemode false

and then IISRESET

NOTE: Maintenance mode of a Production environment is set by a service request to DSE.

UPDATED NOTE: There is now a Deployable Package for enabling/disabling Maintenance Mode so you don´t have to bother DSE. It is in the Asset Library.

NOTE: On Sandbox Environments, do the above procedure on one of the AOSes. You might need to run IISreset on all AOSes.


Adding users WITHOUT an Azure AD Accounts to Dynamics 365 for Finance and Operations

Normally when using Dynamics 365 for Finance and Operations all you users are part of an Azure AD. This is created when ordering your license and is used for authentication. This AD is either stand-alone or synced with you OnPrem AD.

There might be situations where you need to add external users to your Dynamics installation and if these are part of an Azure AD you just use this guide but if the external part does not have Azure AD then it is a bit more problematic… You do not want to add them to your organization since this might add security issues and sometimes licensing costs, and you might not be able to force them to get their own Azure AD tenant.

There is however another way to do this. It will require the user to get a Microsoft Account, that should not be an issue since it is a free account.

  1. Log into the azure portal and go to Azure AD – All Users
  2. Click New Guest User
  3. Add the users Microsoft account (eg *, *
  4. Go to D365FO and choose Import users
  5. Select the new account, import it and give it the correct user role.

Now the user can log in using their hotmail adress

That’s all for today


Force running distribution jobs in Dynamics 365 for Operations Retail

When working with retain in Dynamics 365 for Finance and Operations, distribution jobs are used for moving data between Channel Database and the “AX” transaction database.

The jobs with the prefix P are inbound to AX and the other once are for outgoing sync. In some cases we need to trigger these jobs manually. To do this go to Retail IT – Distribution Schedule. Select the job and click Run Now

When the job is run click the History button to verify that it ran OK.



Call to TTSCOMMIT without first calling TTSBEGIN when installing a Deployable package

I just got an issue when running the DataUpgrade package to 8.1 form the command prompt in a Cloud hosted environment. The package failed on Step 6 with this error:

Application configuration sync failed. Microsoft.Dynamics.AX.Framework.Database.TableSyncException: Custom action sync failed with error: ‘InfoException:Stack trace: Call to TTSCOMMIT without first calling TTSBEGIN.

… followed by a huge stack trace… and since I am not fluent in stack trace I did what everyone does… I call a friend 😉

Fortunately I have great colleagues and I got the instant tip to restart IIS on the server; so I did and I reran the runbook :

AXUpdateInstaller.exe execute -runbookid=[yourrunbookid] -rerunstep=6

Presto… it worked…


Editing an runbook that fails

Today I had an issue with installing a deployable package from the sommand prompt. When the runbook tried to stop the Retail Server i got the following error on step 1:

System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I then saw that it was using the server name, and I thought that it might work using locka host instead… the only problem was that I had imported the runbook and it had failed… how am I supposd to fix this?

I found my runbook file in the folder where I had extracted the package. I opened it in Notepad and ran search and replace on the file. I saved the file and tried to import it again using:

AXUpdateInstaller.exe import -runbookfile=”[runbookfilename]”

and then I restarted the package install using:

AXUpdateInstaller.exe execute -runbookid=[runbookid] -rerunstep=1

Wohoo… it worked!!!

Remember: If you are running AXUpdateInstaller from powershell you need to add .\ before the command


Configuring a LCS Repository for Electronic Reporting in Dynamics 365 for Finance and Operations

In Dynamics 365 for Finance and Operations, Microsoft provides a large repository for Electronic Reports. These cover a lot of scenarios but for those scenarios that requires custom reports you can use LCS to store these in order to share them between environments.

This requires a configuration in D365

First you need to add a configuration provider:

  1. In D365FO search for “Electronic Reporting”
  2. In the right click Configuration Providers

  3. Click New, Give it a Name and a URL and click save
  4. Back in the GER Workspace select the new provider and click Repositories

  5. On the Configuration repositories screen click Add – LCS and Create Repository. Select the correct LCS project and click OK.

    Note: Sometimes you need to make a connection to LCS. To do that click “Click here to connect to LifeCycle Services”. This is done in a separate tab. When it is done switch back to the previous tab and click OK. If you get an error, try again.

  6. To look at the reports in the repository, select it and click Open. You will see the reports stored in the LCS repository.

  7. You are also able to see them directly in LCS, in the Asset Library. If you are working as a consultant this report can then be saved to your personal Asset Library and shared with your colleagues

  8. To give your organization access to your custom report, go to the Shared Asset Library, select it and click Publish

Resetting the DataMart in Financial Reporting for Dynamics 365 for Finance and Operations

There is a universal solution for most problems in Financial Reporting (used to be Management Reporter) and that is to reset the DataMart. The DataMart is an internal data warehouse for Financial Reporting and when something goes wrong it is usually because of bad data in the DataMart. Another reason for resetting it when you do a refresh of the transaction database in D365/AX. Here is how you do it.

  1. In D365 search for “Financial Reports”
  2. Depending on if you see reports or not either select a report and click edit or click new. This will open the Report Designer. Note that you will need to enable pop-ups. Also note that if you are doing this in Chrome you will need an extension called ClickOnce in order to run the designer.
  3. You will need to log in using your Dynamics Account.
  4. Choose a default company /which does not really matter for this operation)
  5. If there are any open report definition close it

  6. Go to Tools – Reset Data Mart…
  7. Check Reset data mart and select the correct reason for the reset

  8. Click OK

    The Data Mart is now reset and filled with fresh data.

  9. Wait for the reset to finish

  10. When all lines have Status RanToCompletion the reset is done.

Renaming a OneBox Dev environment


Tonight I helped one of my developer colleagues who had issues with one of his DEV environments. The issue was that he had renamed the VM (you cannot have multiple machines in Azure DevOps with the same name). The problem was that he had not completed all the steps that is required to rename so it was behaving a bit weird.

First of all we were not able to connect to Reporting Services Configuration Manager. The solution was unfortunately not very logical… In the onebox environment there is a couple of SQL components installed from different SQL Server Versions:

If you use the wrong SSRS Configuration Manager it is not able to connect to the SSRS Server and get the error message: No report servers were found

The correct version is 2016! Completely logical… NOT!

When this was done we just followed this guide to complete the rename and all is well 🙂