onsdag 24 april 2019

SSIS error: The Binary Code for the Script is Not Found issue on SQL server

Hey, long time no see. (if you're reading this). It's been quite hectic the past 6 months so I haven't been doing much blogging as you might have noticed but now it's time again. This time not really Dynamics 365 but related as integrations are one major thing I'm doing.
I've been working on an integration using SSIS for some time now and we've finally gotten to the point that it's time to push to production. Then this error appeared.

To sum things up rather quickly, I have two packages that handles integration, one per source system, and they read customer info and purchase info which our customer wants to see inside CR... eehhmm, Microsoft Dynamics 365 Customer Edition (powered by powerplatform?). I will go through my steps but the solution is really at the end of the post so, by all means scroll down.

They both worked when I run them in Visual Studio in "debug mode" and the first one worked very good when deployed to the SQL server which will orchestrate the integration.

When I deployed the second package I got a validation error saying "The Binary Code for the Script is Not Found" and then it pointed to a script component in the package saying "script component[5212]" (Yes I was lazy and didn't name it after what it did, which was bad it would seem). I did what most developers do, search the internet and there are quite a few hits on the error.


As you can see, I visited most of these but it didn't really help since most of them are addressing issues when running the packages inside Visual Studio and that wasn't really my issue since it was working in Visual Studio but not on the SQL server. These are all saying roughly "do something in the script code, recompile the script and then recompile the package" with a few variants talking about pre compiled code which doesn't seem to be a factor any longer.

Eventually I deleted the script component and recreated the script component, which of course made the entire package misbehave since you're not supposed to do changes to an SSIS package it seems.
This didn't resolve anything either, one thing I did see though is that the script component ID in the error message didn't match the ID of the component in the package which looked sort of strange.

Next step was that I created a new solution, imported the package and compiled it. At this point I was sort of thinking that it was silly to have the same name of the packages when they had the same solution so I renamed the package file, again I was lazy and just let it be called package.dtsx.After a move to the server and installation of the package it validated and ran just fine.

Solution: Don't be lazy and name stuff to what they are doing. Lessons learned: Error messages in Microsoft's products aren't always brilliant, even outside Dynamics.

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 

torsdag 23 augusti 2018

Merge request funnies

I haven't used merge in code for quite some time now, I think the last time I did that was when CRM 2013 was "the shit". Still a funny thing that happens, no biggie and I think most people that does these things get around it fairly quickly. It is however a glitch in the documentation that's worth knowing about.

The issue is in the MergeRequest which takes two inputs as mandatory according to the documentation. It's the "Target", an EntityReference which is a link to the master record, the one that will remain, then its the "SubordinateId" which is just a Guid to the record that should be merged.

So far, so good, now when you just have these two in your request, you get an error, the following error.

There is no UpdateContent, Now this is what the intellisence says about that variable
Not very large, but it says "Optional". It is not.
This variable is an "Entity", the same entity type that the merged records are and in this one you can add whatever fields from that entity that you want to be different from the Target record after the merge and, yes, you can enter whatever you want when you do this programmatically and not only from the secondary record.

Now, this hasn't changed since CRM 2013, it still says optional and you still get an exception if you think that the object is optional.

Small post, hope someone is helped.

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 

måndag 23 april 2018

SSIS projects and (mainly) source control.





Again, a post which is sort of connected to CRM from Microsoft, at this time called Dynamics 365 Customer Engagement. I've been doing some SSIS work to migrate data and ran into an issue with SSIS projects not updating and source control.

The issue is mainly a problem if you're using version control and multiple computers for development BUT, it seems that the project file isn't always saved which gives issues when you alter projects packages and the result is an error saying "The package file ‘package_name.dtsx’ is missing from the project directory. This package has been skipped, and project will continue to load." (or whatever the package name is)
The issue is that the project file doesn't seem to save even if you think it has been. So. Highlight the project file









Then go to File menu and chose save selected

 Now you can upload this to whatever version control you're using and then spread the info :)

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 











onsdag 18 april 2018

This is loosly connected to CRM, SQL Server Management Studio tip of the day

How to connect an SQL Server Management Studio from a different domain?

run the command runas /netonly /user:domain\username ssms.exe


This is Gold!

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 

torsdag 15 mars 2018

Issues publishing from Ribbon Workbench

We ran into issues publishing from Ribbon Workbench a couple of weeks ago and I just recently had time to check this out. My colleague reported this to me and I thought at first it had something to do with his account.

That wasn't the case. The reason why I thought that it was the account is that there were other issues as well. Now I don't have the exact error message since I don't want to revoke what I did but in general terms it said that you're not allowed to publish solutions, make sure you're a system administrator and that you have rights in the catalogue customizationimport.
The culprit folder

This was an on premise CRM 2016 with update 1 and I must have installed at least 10 of these. I've used Ribbon workbench on multiple installations since I first saw the application, probably in CRM 2011 and I have never seen this problem before. I really can't say what has happened and it doesn't appear in the customer's production server to the best of my knowledge.

The solution was to allow the account running Asynch Service to the customizationimport folder, which is located in your CRM server catalogue, as seen above at c:\program files\microsoft dynamics crm\customizationimport.

Again, first time I've seen this and I'm just amazed that the "this is the first time" just never seem to end :)

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 

tisdag 16 januari 2018

CRM for Outlook and the updated TLS demands

If you're running Dynamics 365 Customer Engagement and having issues with CRM for Outlook, there's an update available which will help.

This update isn't listed on the "update and hotfixes" page from Microsoft https://support.microsoft.com/en-us/help/3142345/microsoft-dynamics-365-updates-and-hotfixes which is sort of strange. If you're running the CRM for Outlook (why is it still called CRM and not Dynamics 365 Customer Engagement for Outlook btw?) and all of a sudden it stops connecting to your online deployment, this is probably your rescue: https://www.microsoft.com/en-us/download/details.aspx?id=56327.
This applies to version 9.0 at least, maybe to 8.2 as well but I'm not sure about that.

Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se 


måndag 8 januari 2018

Something happened around new year with Dynamics 365 Customer Engagement Enterprise Edition

Before Christmas we did an integration between an ERP system and Dynamics 365 Customer Engagement Enterprise Edition using the Web API. This integration was running fine until January 3 at 21.32 UTC+1 and by then it couldn't retrieve any data from Dynamics 365.

The only error that was thrown was that one or more errors had occurred and in the inner exception of that it said that "The underlying connection was closed: An unexpected error occurred on a send." and at some other level "An error occurred while sending the request". Not much to go on.

I was pointed to this page by Thomas Sandsør on Facebook (from Microsoft, somewhat safe to open :)) saying that TLS 1.0 and 1.1 will stop working at some time and if you move to .NET 4.6.2 you will be fine.

Now, that didn't quite happen since I still had the same issue running .NET 4.6.2. Digging continues and to my surprise I actually found something at stack overflow (maybe a bit less safe to click on) where they said that you should be able to connect by just using "https" in the connection string but I also found this line of code:"System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;"

Adding that to my code, which it seems I can do pretty much anywhere before I do a call, solves the problem and I'm again able to connect and retrieve data from the Web API.
The funny thing is that I was able to get a token all the time so the authentication actually worked, it was just the GET and PATCH and so on, I guess since the program crashed badly at the GET so I really don't know about the rest but it seems plausable.

Hope this helps.

***Edit
After reading Marius comment below I continued to search for a solution that didn't mean I hardcoded the TLS version which I agree is a ugly solution. This lead me to the following page at Microsoft which says that you have to opt in to get the TLS 1.2 version, that wasn't clear to me earlier so now it works on .NET 4.7 with the following row added to the config file
<runtime>
   <AppContextSwitchOverrides value="Switch.System.ServiceModel.DisableUsingServicePointManagerSecurityProtocols=false;Switch.System.Net.DontEnableSchUseStrongCrypto=false" /> 
</runtime>
 


Rickard Norström
Developer at CRM-Konsulterna
www.crmkonsulterna.se