Monthly Archives: February 2018

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..

Dynamics Portals: Aligning field labels to the left


When designing a form in Dynamics, we can specify, for each section, how field labels will be aligned. It does not seem to have any effect on how those labels show up on the portal, though, since they would always be displayed on top of the fields:


So how do we change label alignment so they that they move to the left? In other words, how can we achieve this:


Turned out it’s doable, and I’ll explain how. It might or might not be the best way of doing this, but it works.

First of all, have a look at this article by Andre Margono – it will explain why I had to apply my customizations via the portal itself rather than in Dynamics:

Actually, if you know why it would not work when done in Dynamics.. drop me a note.

Anyway, here is what I had to do:

  • I knew I had to apply different css styles, so I had to figure out the styles
  • Once I knew what the style are, I had to apply them to that particular section above (so the other sections still have “top” alignment for the labels)
  • The only way I was able to do it is by adding some javascript to the form that would find the section and apply updates style to the controls in that section

Here is the script:

$( “table[data-name|=’CONTACT_INFORMATION’]” ).find(“.control”).css(“clear”,”none” );
$( “table[data-name|=’CONTACT_INFORMATION’]” ).find(“.control”).css(“float”,”right” );

CONTAT_INFORMATION is the name of the section – you can find in Dynamics when looking at the section properties:


The rest is all about finding the table for that section and updating control styles. If you wanted to see the HTML structure, just use F12 option on any of the portal forms and see how they look like on the inside.

Now, thanks to that article by Andre Margono above, I quickly realized that I have to add that script to the form through the portal – somehow those updates were not coming through when done in Dynamics. Here is what I did:

Navigated to the page and opened the editor:


Used Options tab to add custom javascript (see above for the script code):


Hit the “Save” button, and here we go – for that section only, the labels are, now, left-aligned:


Failed to Generate Excel: An error occurred

I was trying to export data to an excel spreadsheet earlier today and ran into something that I have not seen before:

Failed to Generate Excel

An error occurred when Dynamics 365 tried to generate the Excel file. If this problem persists, contact your system administrator.


This was happening on a seemingly innocent view which had lots of columns in it. And, as you can see from the screenshot above, there is not a lot of additional information I was able to find in the log file (since there was no log file).

Was it about the total number of columns? Was it something else? It could not be because of the large data set since I did not have that much data..

What you see on the screenshot below is a reproduction:


There are only a few columns in the view, but if you try to export data to excel from that view, you’ll get exactly the same error. The same will happen if you try to download an excel template using that view.

Notice how there are two different fields with the same display label in that view. That’s exactly what was causing the error – changing the display label for one of the fields so that display labels become unique in the view solves the problem: