onsdag 1 november 2017

October update of Outlook does some chaos with the Outlook app for Dynamics 365

A customer of ours is having some loading issues with the Outlook app so I was doing a bit of searching to see if there was something that could be done. Now this isn't the issue since the data actually shows but it's still a good piece of info that I'd thought I'd share.


In short, a security update for Outlook makes the Outlook app for Dynamics 365 unable to load data and to resolve this you need to add a registry D-word on the machine that runs Outlook.

It's a bit unlucky that there are clashes between different program's updates but a security update is seldom a bad thing so it's good that there's a work around for it.

Rickard Norström
Developer at CRM-Konsulterna

torsdag 5 oktober 2017

Data Sources or Dataset tab in SSDT

This is mainly a note for myself because my SQL Server Data Tool for Visual Studio 2013 keeps hiding the Report Data tab and it takes a good 20 minutes for me to find how to get it back each time.

The magic combination (tm) is Ctrl-Alt-D. I just can't find how to get it back using the menus and I always forget what I should use to search for a solution to this.

Rickard Norström
Developer at CRM-Konsulterna

onsdag 4 oktober 2017

Business process error from custom workflow activity

Last week I was working on a custom workflow activity which was reading some data from CRM and returned a string which was going to be but into an email. This shouldn't be a big operation but I still encountered errors which I hadn't seen before.

The error message that was thrown to me was  System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. Now that's not very informative at all.
Since this was a Dynamics 365 online I'd thought that there might be a ton of stuff that wasn't really working together and I was REALLY going through the code to see what I had written but didn't really find anything weird, just your average custom workflow activity input and output really.

Enter search engine again. https://connect.microsoft.com/VisualStudio/feedback/details/1097462/missingmethodexception-additional-information-method-not-found-0-system-array-empty gave me some pointers where the .NET team responded the following:


Most likely what is happening is that:
- The code is compiling against .NET 4.6, where the reference assemblies include Array.Empty<T>().
- The Roslyn compiler sees that Array.Empty<T> is available and so uses it when generating the empty array needed for the params.
- The compiled app is trying to run on .NET 4.5 where Array.Empty doesn’t exit.

If the above is not the case, please let us know. Otherwise, this is by-design.

Thank you,
.NET Framework

Ok, that was at least pointing to somewhere. I was in fact using .NET 4.6 since it was the default version in VS 2015 and I didn't really think about that and I thought that the Dynamics server would support it. When I changed the .NET version to 4.5.1 it started working as I hoped it would so, new stuff isn't always the way to go.

Rickard Norström
Developer at CRM-Konsulterna

måndag 2 oktober 2017

Problem updating an 8.0 organization to 8.2

It's been a bit of tumbleweed here the past couple of months due to me being on paternity leave. In my naive mind I thought that I was going to be able to do some testing and blogging while taking care of a one year old, the truth is you don't.
Today is my first day at work and I ran into issues right away while updating an 8.0 organization to 8.2. As usual a cryptic error took me on a bit of a hunt to what was needed and I found a solution which may or may not be ideal but it works so far. 

The error message said "14:41:07|   Info| Setting organization state.  New state = Failed
14:41:07|  Error| Update Organization with Id=84095b00-96bf-e511-80ba-00155d02e703 failed with Exception:
System.Exception: Error.ActionFailed Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction ---> System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.SolutionBase' with unique index 'ndx_UniqueName'. The duplicate key value is (SnapshotSolution80).
The statement has been terminated."

Right. Starting search engine power.
The first thing I found was http://kyledoestech.com/updating-crm-2016-to-dynamics-365-fails-with-duplicate-key-error/ which pretty much says, "restore the org db to a server running 8.1 and update it there, then do an update to 8.2". I don't have an 8.1 server available atm so I was hoping I could do something else.

Next stop, Denmark! "http://crmblog.dk/post/2017/01/03/Dynamics-365-Onpremise-Fejl-ved-opgradering-af-organisation.aspx"
Now, this says that the issue is in the solutionbase table, which the error message says too. There's a section called solution but I don't think that the solution is really stated, but I might be misreading it. It did help a little though since I started looking at what was in that table.

This is very much done at your own risk and is unsupported. So far it is working for me but I didn't have an 8.1 server available so this is a bit of a "hope this will work". I would probably not do this to a production organization but this was a test so I thought it was worth a shot.

What I did was to remove the line with SnapshotSolution80 with the command
delete from SolutionBase where SolutionId = '57A85212-B3B4-4C39-BCB0-5D5EF1F5FFC4'.
It looks like that will be re-inserted and I don't have a quick way of running the update on a 8.1 server too. After the upgrade there is a line with unique name "SnapshoySolution80" but with ha different solutionid so hopefully this has been a good dirty fix. So far I haven't seen any issues with my quick fix but keep in mind this is unsupported.
You could run it towards the uniquiname "SnapshotSolution80", which might be a good idea since there COULD be other lines with the same solutionid

Did I mention that this is unsupported

Oh, btw, this is unsuppported.

Rickard Norström
Developer at CRM-Konsulterna

torsdag 16 mars 2017

Install Reporting Services on another machine than the SQL Server

We have faced the question of using an SQL hotel for CRM purposes a couple of times. One problem you could be facing is that the SQL server is hosting several different CRM environments so you needed to install the CRM on a named instance, which of course is possible even with a single installation. Since the SQL server might be hosting several CRMs you needed to install the SQL Server Reporting Services on a different machine.

The Reporting Services doesn't need to be installed on the same machine that is hosting the SQL server and this is a feature that you might be interested in when you are hosting several CRM deployments on the same SQL server. It is possible to host different CRM servers on a single SQL server, although on separate instances of the SQL server, and you can also have separate instances of Reporting Services on that SQL.

The issue is that for the CRM installation you have a component called the Reporting Services Connector that you need to install on the server running the Reporting Services of the CRM system. This software can only handle one CRM server and can only be installed once on a server which means that you can only host one CRM server with a Reporting Services installation so even though you can host multiple CRM servers on one SQL server, you still need one Reporting Services installation per CRM server.
You can install the Reporting Services server on one of the servers used for CRM if you need to minimize the number of servers involved, if you do this you need to think about how your reporting is used because if you do a lot of reporting that server might be loaded and might make the system less responsive for the users.

One thing that's good to know is is that you can't run the reporting sevices service with an account that is used for the CRM installation, i.e. the same account as you're running Asynchronous service with. It is a good thing to have separate accounts for every part of the CRM system, but in this case you are not allowed to use the same account because things won't work.

To install the Reporting Services server on a different machine could also be interesting if you're doing a lot of reporting and you find that the SQL server isn't coping with the load, or you'd like to split them because you'd like to have a lot of power on your SQL server for different reasons but you also want that power to be available for database handling rather than reporting.

Rickard Norström
Developer at CRM-Konsulterna
I’m currently building an integration plugin for a customer that uses an online ERP system that has a REST interface to communicate with the system. To use the REST endpoint in an easier way the company has provided me with a couple of connection DLLs.

This is the first time I’m using external DLLs in a plugin for an online deployment, I’ve previously only done that on premise, and it’s a couple of years ago, so this meant that I’m facing some new challenges.
The first issue is that I can’t just place stuff in the assembly folder and look happy, since it’s online everything needs to be located in the database, and well you can't just put some dlls there so ILMerge is needed to create one dll. At first I was a but curious how the sandbox in Dynamics 365 would react to the external calls that I was going to make but I really didn’t think it would be an issue, and that was a correct assumption, no problems making the calls from the sandbox, one issue out.

The next thing I thought was my salvation is that I’m able to do some testing on an on-premise Dynamics 365 and just setting the plugin to run in the sandbox. This was one issue I didn’t expect. When I ran my code in the sandbox on our server, it was working just fine but when I registered the assembly in Dynamics 365 online I got in trouble, and it’s not really amusing to troubleshoot plugins online. This one was even worse since it was five or so dlls that I had merged using ILMerge, which also was a source of concern. This proved not to be an issue, the dll that was the output from ILMerge was working as planned.

I got a bit of help by George Doubinski  and the issue was that the code I was using implicit typed variables. The reason for this is that I got code examples from the ERP provider. Don’t get me wrong here, I’m not blaming them for that, it just that I’m coming from hardware where everything is explicitly typed so my code is generally explicit typed even though the best practice for C# is to use implicit typed variables. This time however I let it be as the example code was written and since that worked in a sandboxed on-prem I didn’t really think about it.

I’m not sure what it is that makes the dynamic and var problematic here but it was very clear that in this case it did not work online.

The moral of this is that even though you have code that’s working in a sandboxed on-premise installation it might not work in an online deployment. If that happens it might be worth it to start looking at what variable types you’re using. To merge dlls together with ILmerge is working very good though, which is good.
Rickard Norström
Developer at CRM-Konsulterna

torsdag 2 februari 2017

Reporting Services, reports, reporting extension Visual Studio and headache

I was involved in a discussion about report creation in the Microsoft Dynamics CRM group on Facebook the other day where started digging in how to use Visual Studio 2015 for reporting since Jonas Rapp asked about that. He thought it was silly that his devolpment team had to have both VS 2015 and 2012 to be able to work, 2015 for general coding and 2012 for reports.

Now, I have always been using the Data Tools, which has been knows as BIDS (Business Intelligence Development Studio) when I've been doing the reports since most of my report building has been on premise and I need the database to be able to work anyway so I've been doing the job on the SQL server where the BIDS has been installed, or at least after I request it to be installed if it's not our environment.
Since I've been fiddling a bit with SSIS I know it's possible to download the Data Tools for VS 2015, that's the same tool you're using for SSIS and reports so I had a quick look at the Data Tools download https://msdn.microsoft.com/en-us/mt186501.aspx which was all fine and dandy. It worked very good to open a reporting solution and move stuff around. All good.

Now, what I didn't think about was that you might like to do online reports which require the Reporting Extensions. As I said earlier, I haven't done much reporting for online since the customers we've been working with that wants reports have been on premise. Anyway, reporting extension it is and that's available here https://technet.microsoft.com/en-us/library/hh699754.aspx#report_auth_gen_req for Dynamics 365 and on that very page the pre reqs state that it should work with VS 2013 and 2015 however the comments at the bottom pretty clearly says that it doesn't work.

Next thing. As I had installed the Data Tools for VS 2015 I started using them, big mistake. I altered a report for a CRM 2016 update 1 (might be called spring release, I don't know, but it is version 8.1 on premise) and uploaded it to the CRM server. That did not end well and there was a ton of errors saying very odd things which I just didn't care about at the moment, might come back to that later. Thank god for version control, go back to previous version, make the same changes in the SQL Server Data Tool (some VS 2013 shell methink) and upload it again, this time with better results.

The moral is the following, don't use bleeding edge Visual Studio for reporting, unfortunately, specially since it should be working according to the MS pages.

Hope someone gets less headache from this.

Rickard Norström
Developer at CRM-Konsulterna

tisdag 24 januari 2017

Dynamics 365 On Premise (also known as CRM 8.2) licensing

I just had a bit of an eye opener regarding the winter update for CRM 2016 which made it  Dynamics 365. This is a new license model and a new license which is needed to run the server and for CALs for all the users.

That may not be that much of an issue if it wasn't for the upgrade engine. Previously when the new major versions were released there was a new server installation, or an in-place upgrade using some sort of install media. This is not true for the winter update, so if you haven't got it already be careful.
By, "haven't got it already" I mean that since it is distributed as an update, previously known as an update rollup, you will get it installed automatically if you have the "install updates automatically" setting set and then you will have a software which you may not be licensed with.

This is rather late for this but say you have a server which is more or less connected to the internet you may not already have got the update, or if you are manually installing upgrades using Windows Update, untick the CRM upgrade if you don't have a license.

The licensing guide can be found here and the KB for Dynamics 365 update is found here

Rickard Norström
Developer at CRM-Konsulterna