File Source Encoding

I’ve been doing some migration from CSV files over the last few months that resulted in some interesting exercises in the cleansing of data before it gets to Dynamics.

For all of this work, the code was written using C# and the Dynamics SDK.

Encoding

I ran into a number of encoding problems in transferring data from the files into Dynamics. Initially, I thought Dynamics could not handle the character set but on closer inspection, it was the code that wasn’t loading it properly.  I tried a number of different Encoding formats but the one that addressed all scenarios as using the Encoding.Default and let the system decide which to use and when.

Therefore, when loading the data, my initial delimited looked as follows;
var data = File.ReadAllLines(file, Encoding.Default).Select(a => a.Split('\n').ToList());

Delimiters

Since all the data

Read More


Unified Service Desk Customization Files

I’ve been doing some custom hosted control work for the Unified Service Desk lately and wanted to implement the ability to have my controls download automatically on any new deployment without having to copy them over.

The benefits of this approach is that you are not putting your files into your main install directory (and potentially corrupting your USD install) but rather deploying them to your App/Local Data folder where they will be automatically downloaded.

Neil Parkhurst does a great job on the walkthrough there – https://neilparkhurst.com/2017/08/01/usd-customization-files/ – so I’m not going to take away from that.

What I do want to highlight are some other issues I ran into when trying to get things to deploy;

  1. If your zip file is more than 5MB you are going to need to increase your file upload

    Read More


What a Concept?

If you’ve been reading my old blog ForgottenCoder for a while, you know the focus has been primarily on Dynamics and anything that breaks off of it.  Forgotten Coder was a fun experiment but I wanted to keep the focus going on Dynamics and what I learn through it and make that content a little more organized.

Hence, 365Concepts.com.

(that’s it, no other big reveal, thanks for reading, contact if you have questions).

Read More


Joining Queries in Dynamics

I recently finished a project that required some pretty complicated querying between entities to get at the data.

What I found is that I was making too many calls to get linked data between EntityReferences in my code to the server.

To improve the performance of these calls I made use of the Addlink functionality on the QueryExpression.

Whereas before I was making two calls to get at my entity data, now I was only going to make one.

My initial query looked like this

QueryExpression query = new QueryExpression(); query.EntityName = "ENTITY"; query.Criteria.AddCondition(new ConditionExpression("ATTR_FILTER1", ConditionOperator.Equal, APPID)); query.Criteria.AddCondition(new ConditionExpression("ATTR_FILTER2", ConditionOperator.Equal, SearchId)); query.ColumnSet = new ColumnSet(new string[] { ENT_LOOKUP_ID, ENT_LOOKUP_ID2 }); 

var plink = query.AddLink("ENTITY2", ENT_LOOKUP_ID2D , ENT_LOOKUP_ID2 , JoinOperator.Inner); plink.EntityAlias = "PH"; plink.Columns.AddColumns("ATTR_FILTER4", "ATTR_FILTER5");

 

When executed as a normal query, this in turn

Read More


Comments are King

///

That is all it takes to explain what you are doing, why you are doing it, how you are doing it and where you will do it.

It’s not rocket science, it’s not complicated, it doesn’t add hours to your coding effort and in some cases it has the potential to be an added dose of humour to your fellow colleagues as you work through a particularly stressful problem.

Comments were put to me in the best way possible years ago…

Imagine the person behind you is a Crazed Serial Killer and your lack of comments will be the tipping point for them.

Comment your code not only for your team, but for yourself, so you remember why you wrote it, what stress you were under and why it shouldn’t be refactored.

Dynamics Plugins and

Read More