3 Dynamics facts I’ve learned the hard way: the pain facts!

“We keep moving forward, opening new doors, and doing new things, because we’re curious and curiosity keeps leading us down new paths.” — Walt Disney

As Dynamics people , we have to amend our knowledge continuously (get some suggestions from us HERE), and still, no matter what, our LEGO bricks will be partly unknown for us. We are destined to experience: things do not always work as we think (or know) they should, and no, this is not due to bugs.

These are the so called pain facts (credits to Federico Jousset)— kind of fun facts, which we will have to learn the hard way. In the following, please find three cases that caused me some — but not too much — pain this year.


Security Role Templates

Basics: Security Roles define what action a user can perform in Dynamics 365. They can be assigned either to users or owner teams.

The Fun: We can create our own roles by copying OOB ones (best practice!) or start from scratch. As Dynamics 365 artefacts, they keep their GUID after deploying to another instance: no need to amend things such as form access control to use a new local GUID.

The Fact: The OOB roles do change their GUID on each and every Dynamics instance — form access control however still works, thanks to the help of Security Role Templates! Also, if you have an organisational structure, all roles are replicated in the child Business Units. Obviously, each time with a different GUID. So, any automation or synchronisation which transfers for example team settings, should not hastily just use the GUIDs — even though they are used internally for the association!


Order of the Event Handlers

Basics: We can attach JavaScript functions to predefined events (eg. change of field) to react when the event occurs and perform custom client-side tasks.

The Fun: We can attach multiple functions to the same event, to perform different tasks. We can define the order of the handlers, to achieve complex goals.

The Fact: Form customisations (event handlers) are merged during deployment in the target system - as intended. This means, when we define a new handler to be the first in our source instance, it will still be the last in the target, as it will only be added to the list of existing handlers. Hurts, no? And I’m not yet even talking about the future, when you’ll have already amended tons of handlers many times on the same event, and then deployed: “why are my scripts firing off seemingly randomly?”


Hidden dependencies

Basics: We can build upon existing elements. For example, add a new field to a form. This creates a dependency: the form is dependent on the field, so the field cannot be deleted while this connection exists.

The Fun: Dynamics helps you to identify dependencies. We can either use the solution explorer user interface - check each and every element, even a whole solution - or all the dependencies are listed within the extracted Solution.XML file.

The Fact: There are hidden — not listed — dependencies. “Easy” ones are the ones in JS or C# code (eg Plugins): they don’t crush the system, if missed. Worse is for example ReferenceTarget in custom workflow actions, as it breaks solution import. However, the hardest ones are the “leftovers”: navigation elements (relationships from lookups) and orphaned JS libraries on the forms, or persistent business rules listed as RootComponent even after removing a whole entity from solution.. In these cases, there are no shortcuts. You have to be thorough and unstoppable, even if it is a bug, you still have to resolve it.


My point? The value of personal experience is immeasurable. Of course, while facing hard times, the help of the community is the quickest way.

But there are cases, when it is not available, or when even the community does not have the right answers. Don’t turn back though. Push forward! Experiment and understand: what is really happening, why is it not working as intended. Swiftly think of two or three possible theories, and explore them further on a development instance. You will find your answers, and you won’t forget them!

So, what about you? Do you have memorable discoveries? Share your stories in the comments! What was the most painful fact to observe — even if it happened to be trivial for someone else?