16 August 2022

D365FO: workflow development and debugging

There are many guides in the internet how to create a new workflow in D365FO. The process is quite long and complicated.

Here are some of the tips to make it easier for you:

  1. If you stuck and not sure how to implement a specific part of a workflow - check Microsoft's workflows from Application Foundation model. Many good examples there.

  2. When you debugging the workflow, remember to attach your Visual Studio to the "Batch.exe" process, not to the default "iisexpress.exe", else no breakpoint will be hit

  3. The "Rejected" workflow action for some reason is handled by "denied" event handler (WorkflowElementDeniedEventHandler). All other actions (Started, Approved, Canceled, etc.) have event handlers with matching names.

07 July 2022

D365FO: WinRM certificate error while rotating SSL ceritificate

When cloud-hosted D365FO environment is deployed, SSL certificate is generated for accessing local IIS via HTTPS. This certificate will expire after some time and will trigger HTTPS errors when accessing local D365FO instance. SSL certificate could be regenerated via "Maintain" -> "Rotate secrets" menu. 

In some cases "Rotate secrets" task could fail with the following error: "Attempted to remotely execute a powershell script but the WinRM SSL certificate is expired. Please make sure the virtual machine [vm_name] has a valid WinRM SSL certificate before retrying."

Here is easiest way to refresh WinRM certificate:

  1. Login to the remote VM via RDP
  2. Open PowerShell prompt as Administrator
  3. Run the following command to install d365fo.tools, select "A" to install all modules when prompted:
    Install-Module -Name d365fo.tools

  4. Run the following command to refresh WinRM certificate:
    Invoke-D365WinRmCertificateRotation
Restart the VM and check if local D365FO instance could be accessed again without certificate error. If the issue still there - execute certificate rotation from LCS one more time, this time it will succeed.

11 April 2022

D365FO: Visual Studio 2019 crashes

If you tried to develop or debug D365FO customizations using Visual Studio 2019, you probably noticed how often it crashes or shows various errors.

Peter Villadsen, Principal Program Manager from Microsoft, highlighted possible root cause of the problems in his latest post and also provided few workarounds. According to Peter, Visual Studio 2019 is still 32-bit process and suffers from memory limitations while loading lots of PDB files during debugging. One of the options is to enable "Load symbols only for items in the solution" options in "Dynamics 365" debugging settings and manually load required PDB files when needed.

These workarounds are working for small ISV solutions, when you have little number of files per model. In this case you could indeed enable "Load symbols only for items in the solution" options in "Dynamics 365" debugging settings. For the large solutions, however, it does not really work. You will still have objects, which are not in your solution, thus manual PDB loading will be required.

From my experience, the best way to debug D365FO customizations using Visual Studio 2019 is to keep "Load symbols only for items in the solution" option enabled as long as possible and keep an eye on Visual Studio 2019 memory consumption in Windows Task Manager. Disable "Load symbols only for items in the solution" option only when needed to debug Microsoft's code or when you can't add all required objects to your solution (for example, if you have multiple models or too many files). Once Visual Studio 2019 will consume more than 8GB RAM, it will surely crash. Just restart Visual Studio before it crashes and continue your work.

16 March 2022

D365FO: the easiest way to fix BPErrorEDTNotMigrated best practice warning

BPErrorEDTNotMigrated best practice warning could appear when you generate a data entity for a table. If a table has EDT fields based on Microsoft's data types, such as VendAccout, CustAccount, the warning will appear.

The easiest way to fix the warning is to find a field mentioned in the warning message and set "Ignore EDTRelation" to "Yes".



19 November 2021

D365FO: custom resources are not deployed on developer's VM

I had another case recently when custom resources (JavaScript, HTML pages etc.) were not deployed to the Webroot folder on developer's VM. As a result, when such resources are required, different kind of errors are thrown, such as "file not found" or "runtime error".

This often happens when model binaries added on another machine to version control and got synchronized to the local VM. Resource deployment happens when deployment package is deployed manually or from LCS, but not when code/binaries are synchronized from Visual Studio.

It is possible to trigger resource deployment manually, here is how to do it. You will need any recent deployment package. If you do not have one, you could always create new from Visual Studio (via Dynamics 365 menu -> Deploy -> Create deployment package) or use one of the sample packages from "K:\AosService\PackagesLocalDirectory\bin\CustomDeployablePackage" folder.

  1. Extract all files from deployment package
  2. Open PowerShell console or ISE in Admin mode
  3. Run \AosService\Scripts\InstallMetadataPackages.ps1 script to redeploy resources

PS: there is another file with the same "InstallMetadataPackages.ps1" name located under K:\AosService\PackagesLocalDirectory\bin. In my case the file content is different and I get runtime errors while trying to run it. 

13 September 2021

Office 365: Disable junk email filtering on a shared mailbox

Shared Office 365 mailboxes are quite useful in many scenarios. We use one of them for task  automation, when external Microsoft Flow is triggered based on incoming email. Recently some valid email were blocked by junk email filter, here is the way how junk filter could be disabled.

  1. Go to https://outlook.office365.com/ecp/your_email@your_domain.com (replace your_email@your_domain.com with your own shared mailbox email address)

  2. Click "block or allow" on the left pane

  3. Click "Don't move email to my Junk Email folder" radio button

28 August 2021

LCS: configure email notifications

Once you start using Microsoft Dynamics Lifecycle Services (LCS), it will start sending notification emails based on various events. Very few of them are useful, majority goes directly to trash folder.

Luckily it is quite easy to configure LCS notifications settings. Click on the "settings" icon on top right corner, next to your name, then select "Notification management".