Author Archives: Alex Shlega

Creating a web version of the plugin registration tool

For the last month or so I have been trying to create a web-only version of the plugin registration tool. As much as I’d like to say it’s done, it’s not the case. Looks like, at least for now, I just have to put it on hold since this has been taking an absolutely insane amount of time.

Still, there is a bunch of things I have learned/experienced first-hand, so that is what I wanted to share. What I learned in the last month.

I’ll probably split this into two different post categories, though.


  • There is nothing preventing us from creating our own file upload UI elements in Dynamics. That’s right, the concept of using  “notes” as the only option for file uploads is officially deprecated(and has been for a while). HTML5 combined with javascript and plugins can do wonders
  • As of now, it seems nothing can beat custom actions when you need to create an interface between your javascripts and plugins
  • Technically, plugin registration tool seems to be using unsupported techniques to deploy plugins in Dynamics. Which is fine, though, since it’s provided as part of the SDK
  • There are some drawbacks associated with using custom actions to store configuration settings



  • When planning a Dynamics project, you have to think of the people resources carefully. The complexity of those customizations can vary a lot, and, quite frankly, this time it was a bit too much for me since I probably had to spend more time catching up on the usage of Vue, for example, than doing actual development
  • You also have to think of the architecture and consider the limitations. For example, when I’m thinking of XrmToolBox, I realize it’s a very useful tool(or should I say framework?) Still, personally I favor those tools which are deployed directly in Dynamics.. those I can use without having to install anything on my machine. Problem is, not everything is easily doable in that architecture, and, also, that kind of development requires different skillset


I will cover all of the above in more details, but, if you are interested in what I’d call the “proof of concept” of the web-based plugin registration tool, you will find all the sources here:

It is just that at this point – proof of concept:


What’s important is that it runs as a web resource in Dynamics, and you can actually upload a file and register it as a plugin assembly (including all the plugins). Whether this proof of concept will ever turn into a working “product” is a good question.. but, with that, let’s continue to the technical “lessons learned” (coming soon)

Configuration Data Manager – version

Another update for Configuration Data Manager is available:

Here is what’s included into this update

You can use “Configuration Data” button to open the tool:


There are two new dataset configuration parameters:


When “Create Only” is selected, only new records will be imported to the destination environment. Sometimes, we don’t need to update existing configuration data, but we still need to make sure new “configuration data” has exactly the same guid-s everywhere.

Also, “Lookup Field” attribute allows to specify a search field which is different from the entity id field used by default. This option only allows you to find and update configuration data using a different search field, but keep in mind it does not really help with lookup resolution. So use at your own risk since you may end up having different guids in different environments. But, again, sometimes this happens.

“Import All” command will offer a few options:


When importing “all” data, you can choose to either include home data or exclude it from the import. More often then not, you probably won’t need to include it since, after all, “home data” is what you are likely going to import to other CRM environments instead.

Also, when using “import all” you can override dataset-level “create only” (see above) and instruct the tool to actually update all records (not just create new if that option is selected on the dataset level)

Configuration Data Manager updates: improved lookup resolution, longer FetchXml, “applied on” date


Based on the feedback I got so far, there is an updated version of the configuration data manager solution:

Here is what’s included into this update:

  • You can use more than 2000 characters for the FetchXml
  • When importing configuration data, all non-existing references  will be removed. You can still get the lookups assigned properly if you first import “parent” data and, then, child data. Another option might be to run the import twice if the data is self-referenced in some way. During the first import, it’ll be imported without lookups. During the second import, it’ll be updated, and the lookups will be set correctly.
  • Finally, you can now see not only when the data was modified/prepared(“modified on” column), but, also, when it was applied/imported in the current organization:


Note: business unit – owned entities such as “teams” will be assigned to the root business unit during the import.

Dynamics Configuration Data Manager 1.0 – add configuration data to your solutions!


There are various tools out there we can use to move configuration data from one Dynamics environment to another, but what if we could add data directly to our solutions? So that there would be no need to run XrmToolBox, package deployer, SSIS, Scribe, or other tools in order to get our base data, always with the same guid-s, deployed? So that we would provide the solution file, and, once the solution has been imported, it would take just one click of a button, all in Dynamics, to get that data imported?

If this sounds remotely interesting, there is a tool I’ve been working on which you might want to try:


You can download it from here:


Here is how it works:

  • Using the tool, you can create different datasets. Those datasets are based on FetchXML, and you can give them priority order (When “Import All” option is selected, the dataset with the lowest order # will be deployed first. For example, if you have lookups somewhere, you might want to deploy your “parent” records first followed by the “child” records). Creating a new data set is simple – just click “New Data Set” button:image
  • Once you have a data set, you can prepare all data or just that particular data setimage
  • This is where there is some difference between “home” datasets  (those created in the current Dynamics organization) and external datasets. You cannot update external datasets – you can only load data from them.
  • For every dataset, there will be a web resourceimage

Once the datasets are there, and once you have prepared the data (using “Prepare All”, for example), you can include those web resources into a new/existing solution, and, then, bring them over to another environment.  As in the example below, I have two web resources included into a separate solution:


I might have included them into an existing solution – it does not matter. What matters is that, once you bring those web resources to the target environment, and if you have Configuration Data tool installed there as well, you can use “import all” option (or import each individual dataset separately) to deploy that data in the target environment:


For example.. I have no accounts here other than “test” account:


I am using “Import All”:


And now I do have the accounts:


As for the limitations.. The main limitation of this first version, is that it does not support N:N system entities and some of the more advanced data types (such as multiselect optionsets, activity parties, and/or customers).

And there is a bunch of improvements I can see right away (including ID mapping, solution mapping, more advanced lookup resolution mechanism, moving the whole thing to GitHub, etc).

Yes, there is some work to do for version 2. For now that’s what it is, though, so let me know what you think!

Updates by version #:





PackageDeployer – failed to load the import configuration

When trying to deploy a package created using the PackageDeployer tool, you may run into this error:


“Failed to Load the Import Configuration : Config File Missing”

The error is, actually, self-explaining.. in a way.

Every package has two components: there is a dll, and there is a package folder. In order to deploy the package, as per the instructions here:

You will start by copying the package folder and the dll to the PackageDeployer tool folder. So, when you start the PackageDeployer, it will look for all the package dll-s first, and it will allow you to choose the package if it finds the dll..

However, once you get to that step where the PackageDeployer is supposed to read package configuration, you’ll need to make sure your package folder name corresponds to what you have in the PackageTemplate.cs:


If you rename the folder while creating a package and leave GetImportPackagedataFolderName unchanged, PackageDeployer will actually be looking for the PgkFolder directory, and, so, that’s when you will see that error message above.

When a security issue is not a breach but still a pesky bug


What if you think you can update a record, and there are all the indications that you can, yet you try to change something and it just does not work?

In the example below(which I’ve originally discovered in 8.2.2, though the screenshots below are from 8.2.1), my test user seems to have “write” permissions, the form is not read-only in Dynamics, so I can modify field values on the form:


And yet, I’m getting an error message when trying to save the changes:


  <Message>SecLib::AccessCheckEx failed. Returned hr = -2147187962, ObjectID: c1d0e243-1e18-e811-9401-00155d00c101, OwnerId: 5c19475b-16f4-e711-93fe-00155d00c101,  OwnerIdType: 8 and CallingUser: 5c19475b-16f4-e711-93fe-00155d00c101. ObjectTypeCode: 10018, objectBusinessUnitId: 63746438-10f4-e711-93fe-00155d00c101, AccessRights: WriteAccess </Message>

So what happened?

“Security Test” is a new entity I just created

There is a security role that’s setting access to that entity like this:


Now here is the catch: that security role is not assigned to the user – instead, it’s assigned to the team, and my use is a member of that team.


And that team has  a role:


You would think my test user would have permissions to update the record. AccessChecker plugin in XrmToolBox seems to think so. Dynamics client side itself seems to think so.. But, apparently, something fishy is happening on the server side – it has its own opinion about who can actually update that record.

Interestingly, it’s all working fine if the record is assigned to the team instead. As a member of the team, my test user can happily update such records. I can even assign that record from the team to myself under that user account (because yes, the role has that permission). But, once the record has been assigned to me, it’s all over – there is nothing I can do with that record anymore.

BTW, the workaround for this is relatively simple – I just need to assign the same role directly to my test user.

Dynamics: Drawing activity sequence diagram


For the reasons not clear to myself, I was looking at the js-sequence-diagram library (, and it occurred to me that I might probably use such a diagram to display the sequence of activities on the entity form.

And indeed.. here is what I ended up with:


If you wanted to try it yourself, just follow the steps below:

1. Download the solution file and import it to Dynamics (it was exported for 8.2 version, btw)

This solution will deploy a number of web resources, and it will also add a new custom entity (Diagram Demo).

2. Create a new Diagram Demo record (you can do it using Advanced Find, for example)


3. Add a few phone calls to the newly created record


4. Reload the form (as in, use F5) and observe the results


As for the details on how it works, here is a brief explanation. First of all, there is nothing special about the entity above. It’s using a few web resources which are included into the solution, so, basically, it’s just a demo entity – you can do the same with any other entity.

To start with, you need to add ita_sequence_diagram.html web resource to the entity form:


You also need to create a multi-line text field and put it on the form (you can make it invisible of you wish)


Then, you need to configure onLoad event handler for the form:


– Add ita_/scripts/diagramsupport.js library

– In the onload event, use DrawSequenceDiagram function

– Pass two parameters: multiline attribute name and web resource name


Save and publish all.

The only remaining part is that you need to populate that multiline field with the “Sequence”. I used a workflow for that, and you will find it in the solution – it runs on create/update of the phone calls, and it just keeps adding text to the multiline attribute.. pretty strightforward:


It does not have to be a workflow – you can make something more elaborate (javascript, plugin, workflow.. or any combination of those). For the exact syntax of what should be stored in the multiline control, have a look at the js-sequence-diagram web site. Here is the link again:

Have fun!

Entity ownership type: Business Unit


What the heck am I talking about? “Business Unit” ownership!? That’s not even a thing:


That’s more or less what I replied in the community forums to somebody who was asking about “business unit” ownership.

And yet, it does exist, even if it’s not something you can set up for your own custom entities:


You will find it on MSDN, too:

Entities that belong to a business unit. These entities have an attribute named owningbusinessunit.

Although, it seems even Microsoft itself got confused since they are mentioning owneingbusinessunit attribute which is NOT there for such entities. There is busineeunitid:


Owningbusinessunit is, actually, an attribute that you will find in the user/team owned entities. Such as an account entity, for example.

So what does all this mean, in practice?

Well, here is the thing.. When creating a team, or any other business unit – owned entity through the SDK, we have to set that businessunitid field. Otherwise, there will be an error:


An error has occurred: Expecting business column to be set for Creating business owned entities, business column is null

And, also, when setting up security, the minimum permission depth for such entities is “Business Unit”:


Every user in the business unit that owns the record will have access, and there is no way to make it more granular (user-level). Interestingly, that’s one of the caveats of the security model I used to notice occasionally, and, then, mostly used to dismiss as some strange quirk. Turned out there is an explanation.

Invalid User Authorization error

Was trying to enable data encryption in Dynamics and the next thing I knew there was an error message:


Invalid User Authorization

The user authentication passed to the platform is not valid.

It’s a rather vague message to say the least, so a quick google search revealed some links but no definitive answers. Lucky for me, this error was happening in the on-premise environment (although, where else would I need to enable the data encryption, right?) Even more, it was happening on my virtual machine, so I had full access..

Turned out the error message showing up in the windows event log on the CRM server was different, and, actually, much more useful:

Exception information:

Exception type: CrmException

Exception message: HTTPS protocol is required for this type of request, please enable HTTPS protocol and try again.

Now that’s straightforward. Yes, I did not have HTTPS..