Microsoft Dynamics 365 Business Central WebClient with no Role Center

Dynanmics 365 Business Central logo

Is your Microsoft Dynamics 365 Business Central Windows Client working, but your Web Client gets stuck with this picture just after log in?

WebClient - no Role Center
WebClient – stuck with no Role Center just after login.

…and do you see events like these in the Windows eventviewser on the Server? (sorry – I know it is in Danish: “fejl” translates to “error” and “undtagelse” means “exception”)

Der opstod fejl under forsøg på adgang til webstedet 
Type: Microsoft.Dynamics.Nav.Types.NavCancelCredentialPromptException
Message: Der blev udløst en undtagelse af typen 'Microsoft.Dynamics.Nav.Types.NavCancelCredentialPromptException'.
StackTrace:
   ved Microsoft.Dynamics.Nav.Client.ConnectionEstablisher.PromptForCredentials() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.ServiceConnection\ConnectionEstablisher.cs:linje 1041
   ved Microsoft.Dynamics.Nav.Client.ConnectionEstablisher.OpenConnection[TChannel](ConnectionRequest connectionRequest, ConnectionOptions connectionOptions, UserSettings& userSettings) i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.ServiceConnection\ConnectionEstablisher.cs:linje 196
   ved Microsoft.Dynamics.Nav.Client.ServiceConnection.OpenConnection() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.ServiceConnection\ServiceConnection.cs:linje 892
   ved Microsoft.Dynamics.Nav.Client.ServiceConnection.Initialize() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.ServiceConnection\ServiceConnection.cs:linje 561
   ved Microsoft.Dynamics.Nav.Client.FormBuilder.BuilderSessionInitializer.OpenConnectionToServer() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.Builder\BuilderSession\BuilderSessionInitializer.cs:linje 265
   ved Microsoft.Dynamics.Nav.Client.FormBuilder.BuilderSessionInitializer.InitializeCore() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.Builder\BuilderSession\BuilderSessionInitializer.cs:linje 92
   ved Microsoft.Dynamics.Nav.Client.FormBuilder.BuilderSessionInitializer.Initialize() i S:\Depot\Platform-Core\platform\client\Shared\Prod.Client.Builder\BuilderSession\BuilderSessionInitializer.cs:linje 76
   ved Microsoft.Dynamics.Framework.UI.UISession.Initialize() i S:\Depot\Platform-Core\platform\client\Shared\Prod.ClientFwk\Session\UiSession.cs:linje 1094
   ved Microsoft.Dynamics.Nav.Client.Web.NavWebUISessionInitializer.InitializeCore(UISession session) i S:\Depot\Platform-Core\platform\client\web\Prod.Client.WebCommon\Session\NavWebUISessionInitializer.cs:linje 94
   ved Microsoft.Dynamics.Nav.WebClient.NavWebClientUISessionInitializer.InitializeCore(UISession session) i S:\Depot\Platform-Core\platform\client\web\Prod.Client.WebClient\Session\NavWebClientUISessionInitializer.cs:linje 65
   ved Microsoft.Dynamics.Nav.Client.Web.NavWebUISessionInitializer.Initialize(UISession session) i S:\Depot\Platform-Core\platform\client\web\Prod.Client.WebCommon\Session\NavWebUISessionInitializer.cs:linje 77
   ved Microsoft.Dynamics.Framework.UI.Client.OpenFormExecutionStrategy.TryInitializeUiSession(UISession session) i S:\Depot\Platform-Core\platform\client\Shared\Prod.ClientFwk\Client\Interactions\ExecutionStrategies\OpenFormExecutionStrategy.cs:linje 67
   ved Microsoft.Dynamics.Framework.UI.Web.WebOpenFormExecutionStrategy.TryInitializeUiSession(UISession session) i S:\Depot\Platform-Core\platform\client\web\Prod.Client.Web\Interactions\ExecutionStrategies\WebOpenFormExecutionStrategy.cs:linje 61
   ved Microsoft.Dynamics.Framework.UI.Client.OpenFormExecutionStrategy.Execute() i S:\Depot\Platform-Core\platform\client\Shared\Prod.ClientFwk\Client\Interactions\ExecutionStrategies\OpenFormExecutionStrategy.cs:linje 41
   ved Microsoft.Dynamics.Framework.UI.InteractionManager.<>c__DisplayClass8_2.b__4() i S:\Depot\Platform-Core\platform\client\Shared\Prod.ClientFwk\Interactions\InteractionManager.cs:linje 125
Source: Microsoft.Dynamics.Nav.Client.ServiceConnection
Error accessing Website 
Unhandled error occurred on a browser or device client:
{
  "clientInfo": {
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18362",
    "browserLanguage": "da-DK"
  },
  "message": "Unable to get property 'getElementsByClassName' of undefined or null reference",
  "pageUrl": "https://xxxxxxxxxx/yyyyyyyyyy/?runinframe=1",
  "originalError": {},
  "location": {
    "name": "https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0",
    "url": "https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0",
    "lineNumber": 4562,
    "columnNumber": 58
  },
  "detailedMessage": "   at DN.LogicalFormAdapter.prototype.$105 (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:5188:1958)\r\n   at DN.LogicalFormAdapter.prototype.initializeNativeControl (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:5152:101)\r\n   at DN.LogicalControlAdapter.prototype.$27 (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:4839:1117)\r\n   at DN.LogicalControlAdapter.prototype.createContent (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:4833:6623)\r\n   at DN.LogicalControlAdapter.prototype.buildCore (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:4834:399)\r\n   at Type.prototype.callBaseMethod (https://xxxxxxxxxx/yyyyyyyyyy/js/mscorlib.js?h=D3729A20D7B95888CE98A4A7D3E48A9F0C340D80C5F72A67326464A956360F0E&_v=1.0.0:1:23528)\r\n   at DN.LogicalFormAdapter.prototype.buildCore (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:5160:156)\r\n   at DN.LogicalControlAdapter.prototype.build (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:4833:6709)\r\n   at DN.LogicalControlAdapter.prototype.buildChildAdapter (https://xxxxxxxxxx/yyyyyyyyyy/js/framework.js?h=69F05AE1092A2D30721123840E70FB027600B5F7A4BA9069BAE99A1E20C9168D&_v=1.0.0:4834:1581)\r\n",
  "requireUserToSignOut": false,
  "silent": true
}

Well – congratulations. You probably hit the same rabbit hole I just wasted 2 hours on.

Please go through you Role Center PageParts and check if you by mistake filled the InstructionalTextML property with something. I don’t want you to check the Role Center page, but check the individual PageParts pages. It is a global parameter on them.

If you did – remove it and this problem is magically gone :-)…

Note: This issue HAS off cause been reported to Microsoft (it got case ID 119071922000172 ). They have confirmed that it also seems to be present on Microsoft Dynamics 365 Business Central 2019 spring release.

I’ve discovered it in 2018 fall release CU7 (running single tenant and NavUserPassword authentication – not that I think that is part of the cause). I’ll expect it to be also present in at least 2018 fall release CU9 and 2019 spring release CU1.

Microsoft confirms they are looking into fixing it and a fix will be released in a future CU.

Publish-NAVApp : Extension compilation failed

Dynanmics 365 Business Central logo

Have you ever tried to publish an app-file using the Publish-NavApp PowerShell Cmdlets on a on-premises Microsoft Dynamics 365 Business Central and was stopped by errors like these:

Publish-NAVApp : Extension compilation failed
source/codeunits/Cod13653.PaymentExportManagement.al(4,27): error AL0185: Codeunit 'Payment Export Mgt' is missing
source/codeunits/Cod13656.DataMigration.al(15,28): error AL0185: Codeunit '9002' is missing
source/codeunits/Cod13650.FIKManagement.al(54,24): error AL0185: Table 'Payment Method' is missing
source/codeunits/Cod13650.FIKManagement.al(98,29): error AL0185: Table 'Company Information' is missing
source/codeunits/Cod13650.FIKManagement.al(126,59): error AL0185: Table 'Bank Acc. Reconciliation' is missing
source/codeunits/Cod13650.FIKManagement.al(128,18): error AL0185: Table 'Bank Account' is missing
source/codeunits/Cod13650.FIKManagement.al(129,22): error AL0185: Table 'Data Exch. Def' is missing
source/codeunits/Cod13650.FIKManagement.al(130,26): error AL0185: Table 'Data Exch. Mapping' is missing
[…]
source/codeunits/Cod13657.FIKSubscribers.al(360,46): error AL0132: 'Page' does not contain a definition for 'Payment Application'
 source/codeunits/Cod13657.FIKSubscribers.al(361,56): error AL0185: Page 'Payment Application' is missing
 source/codeunits/Cod13657.FIKSubscribers.al(361,111): error AL0185: Table 'Bank Acc. Reconciliation Line' is missing
 At line:10 char:1
 Publish-NAVApp -ServerInstance $ServerInstance -SkipVerification -Pat …
 ~~~~~~~~~~~~~~~~~ CategoryInfo          : InvalidOperation: (:) [Publish-NAVApp], InvalidOperationException
 FullyQualifiedErrorId : MicrosoftDynamicsNavServer$DynamicsNAV/nav-systemapplication,Microsoft.Dynamics.Nav.Apps.Management.Cmdlets.PublishNavApp 

Note – it seems that all objects are missing!?

It seems illogical, but it is fixed by running symbol generation:

  1. In the Microsoft Dynamics 365 Business Central administrative console you should set the parameter Enable loading application symbol references at server startup in the Development group.
  2. Then you should go to the Program Files (x86) installation folder for the Role Tailored Client (typically C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\<version>\RoleTailored Client) and run this command:
finsql.exe Command=generatesymbolreference, Database="<application sql database>", ServerName=<sql server host name>, ntauthentication=no, username=<sql server username>, password=<sql server password>

Note: The finsql.exe command will start a background finsql.exe process (you can see it in Windows Task Manaer). When it finishes it will write one or two text-files in the Role Tailored Client directory – one with status (filename navcommandresult.txt) and the other one if any errors happens (filename naverrorlog.txt).

These two steps fixed it for me.

You can read more about the symbol generation in the Microsoft documentation by clicking here!

Bad Request – Error in query syntax.

PowerShell logo

No, this is not an error in WordPress on this server – “Bad Request – Error in query syntax.” is in fact the intended subject for this Blog post :-).

If you are running OData WebServices towards you Microsoft Dynamics NAV or 365 Business Central (DBC) and you get this error – and you have a forward slash ( “/” ) in the company name in question, then this Blog post is for you :-).

You have just discovered that Excel, PowerShell.exe and/or older version of PowerShell ISE cannot work with OData URLs with a forward slash in the …/Company(‘<my company name>’)/… part of the URL.

A obvious solution is to rename the company in NAV/DBC – but that is not really a neat solution, is it?

According to this Microsoft blog post, another far superior solution exists. NAV/DBC supports two syntaxes when stating the company name.

The “classic” one you use for OData version 3 when you got the error:

https://<my hostname>:<my odata port>/<my instance>/OData/Company('<my company')/<my webservice>

…or the corresponding OData version 4 one:

https://<my hostname>:<my odata port>/<my instance>/ODataV4/Company('<my company')/<my webservice>

…and another one for working around this error:

https://<my hostname>:<my odata port>/<my instance>/OData/<my webservice>?company='<my company>'

…or the corresponding OData version 4 one:

https://<my hostname>:<my odata port>/<my instance>/ODataV4/<my webservice>?company='<my company>'

Note that you can off cause add additonal parameters (selecting tenant or setting filters etc.) to the URL using the ampersand sign ( “&” ) – just like you do when construction any URL.

Congratulations – you solved your problem 🙂

If you want to learn more about OData towards NAV/DBC, I suggest you visit these links:

“External Azure Active Directory” users and Single-Sign-On in Dynamics 365 Business Central

Dynanmics 365 Business Central logo

If you are setting up Single-Sign-On (SSO) for Dynamics 365 Business Central (DBC) and you are only able to authenticate users local to the Azure Active Directory (i.e. non Guest or “External Azure Active Directory” users), then you might have stumbled across the same error as me.

The error manifests itself by allowing you to log in using SSO, but just when the DBC webclient is suppose to open, you get this error:

Your user name or password is incorrect, or you do not have a valid account in Dynamics 365 Business Central.

The problems is that a user with that authentication e-mails IS in fact present in DBC – so the error makes no sense.

Also you will sometimes get a warning in the Event Viewer that the SSO token was valid, but the user could not be found in DBC.

As mentioned the local domains works fine, it is only if you try to add external users and authenticate with those it does not work:

User type: Guest
Source: External Azure Active Directory

I’ve seen this error in Microsoft Dynamics 365 Business Central 2018 fall release with cumulative update 1 and 2.

I’m aware that you – with powershell – can change a User type Guest to a User type Member. I tried it, but the result was the exact same. So “no cigar” for that solution.

After upgrading the platform to the latest Cumulative Update (which is 7 while I’m writing this), the error is completely gone. So there you have your fix :-).

Note: I’ve not tested all the CUs between 2 and 7 to figure out when it was fixed or if there is a entry in the fix list that mentions this – so if you have more knowledge about that, please share by adding a comment.

DBC: “An error occurred while trying to display the report.”

Dynanmics 365 Business Central logo

If you get this error when you try to preview a report in Dynamics 365 Business Central:

An error occured while trying to display the report

An error occurred while trying to display the report.

…your firewall may be to restrictive.

A symptom of the same error is if you hit the Print button instead of the Preview button, and the preview during printer selection shows a “403 – Forbidden: Access is denied”-error.

We have seen this on Azure Firewall when it was set to “Prevention mode” instead of “Detection mode”. I guess one could whitelist the requests and keep “Prevention mode”, but how to do that is off cause Firewall dependent and outside the scope of this posts.

If you have a solution for your firewall, feel free to add it as a comment :-).

Broken Microsoft Dynamics 365 Business Central Single-Sign-On with Multi-Tenancy setup

Dynanmics 365 Business Central logo

After having a Single-Sign-On (towards Azure Active Directory)/Multi-Tenancy setup running on Dynamics NAV 2018 for some time, I tried to create the same setup with Microsoft Dynamics 365 Business Central 2018 fall release.

And to my surprise it failed with this error just after logging in: “The value for the WSFederationLoginEndpoint configuration settings cannot be empty.”. My “WSFederationLoginEndpoint” setting was NOT empty, so the error does not make any sense.

The value for the WSFederationLoginEndpoint configuration settings cannot be empty.
The value for the WSFederationLoginEndpoint configuration settings cannot be empty.

It puzzled me for a while because these setups was working without any problems:

  • Dynamics NAV 2018, Single Tenant
  • Dynamics NAV 2018, Multi Tenant
  • Dynamics 365 Business Central 2018 fall release, Single Tenant

So the Single Tenant BC was working, but failed as soon as I configured it for Multi Tenancy.

Finally after weeks of messing around I gave up and reached out to my contacts from Microsoft Development Center Copenhagen to see if they could help me solve the issue (first I off cause raised a ticket with Microsoft Support). Luckily Freddy from https://freddysblog.com/ knew exactly what was wrong with my setup – and was able to send me the exact solution. And made the effort to do this on a Saturday morning! 🙂

THANK YOU FREDDY 🙂 !!! – please click here to visit his blog!

Oh – I almost forgot. If you have this error, empty these configurations settings from the Service Tier:

  • AzureActiveDirectoryClientId
  • AzureActiveDirectoryClientSecret

These two settings are used in Dynamics NAV 2018, but should be left empty in Microsoft Dynamics 365 Business Central.

Broken AL in Visual Studio Code October 2018 release (1.29)

Visual Studio Code logo

October 2018 release (1.29) for Visual Studio Code was just released, but unfortunately it breaks the possibility to publish AL extensions to your Dynamcs NAV / 365 Business Central.

Don’t blame the guys behind Visual Studio Code, this one is probably on the AL extension guys.

Only solution i know is to downgrade Visual Studio Code to the September 2018 (1.28.2) release or earlier for now, but I’m sure it will be fixed in the next CUs for NAV/BC.

The symptoms of this error is:

  • When publishing you don’t get any output in the VSC DEBUG CONSOLE. Only the OUTPUT shows the “normal” behaviour.
  • The Web Client won’t start after the publish.
  • The extension is not published if you start Web or Windows Client manually and check.
  • Your Windows Event Viewer will have several errors from your NAV Service tier with lots of call stack for each attempt to publish. The important text to search for is errors like:
    • Message (InvalidOperationException): RootException: InvalidOperationException
      This operation cannot be performed after the response has been submitted.
    • Message Failed request — Method:GET; Url:http://localhost:7349/NAV130_GSL/dev/metadata; StatusCode:InternalServerError; ReasonPhrase:Internal Server Error; Token:
    • Message (InvalidOperationException): RootException: InvalidOperationException
      Dynamic operations can only be performed in homogenous AppDomain.

The missing AL language support for VSC October 2018 release (1.29) was mentioned very briefly at NavTechDays 2018 in one of the first sessions (forgot which one), but I’ve not been able to find it on Google, so that is why i provide this blog post.

These kind of errors is almost impossible to trouble shoot if you cannot Google them :-).

Hint: Visual Studio Code will auto-update to the newest release automatically. To disable this, go to File/Preferences/Settings and change the “update.channel” to “none”. I highly recommend that you return this setting to its original value when the AL-language guys fix this error.