You are here

Application Development

Uploading a file to Microsoft CRM using JavaScript

I recently had a need to upload a file to Microsoft CRM as an attachment to a note (from within CRM) using a custom button on the ribbon and some JavaScript. After doing some research, I kept finding examples that worked but they required using a function in VBScript to convert binary data to a base-64 ASCII string. I didn’t want to have to use a VBScript function since my customer does not require their users to use Internet Explorer.

Spaces vs. Empty Strings in TSQL

Recently, I was running some SQL queries when I came across an oddity that I previously was unaware of. In the UI of our project, we were having some strange validation issues. Data was being binded to text fields and sometimes text fields (that appeared blank) were correctly validated as being empty, but other times they appeared to have a value. I ended up highlighting the value of the textbox to ensure that it was blank and noticed that some of the fields actually had a space value in them (' ').

CRM 2015 Tips: Use ExecuteMultiple to Improve Plugin Performance

Firing off a quick service.Insert(entity) or service.Update(entity) is an easy way to get data into the system, but can start to have an impact on performance if your plugin is attempting to update, insert or delete more than just a few records. By taking advantage of the ExecuteMultipleRequest class, you can process your requests in batches, potentially improving performance significantly. MSDN documentation on both the ExecuteMultiple method and ExecuteMultipleRequest class can be found here:

MVC: Dropdown list for Enums

In .NET, enums are a heavily used component of the framework. I personally love the use of enums because it is a strictly typed datatype and increases code readability significantly. Since it is also supported in the Entity Framework, I find myself dealing with a lot of entities that contain enum-based properties. Consequently, this bleeds into the design of my view models, which will often “inherit” the properties’ datatypes of the entities they are based on. This is in particular true for view models that are part of an HTML form and will therefore be sent back to a controller method.

ActivityMimeAttachment and ObjectTypeCode in CRM

I was using JavaScript to create an ActivityMimeAttachment record in CRM. Although I’ve done it before, I couldn’t find my old code. So, I did the next best thing: found an example online.

Of course you should always be wary of code you find online. Here’s why: apparently this individual never actually tried the code they posted (maybe they wrote it from memory?) because when I tried it, it didn’t work. Every time I’d send my ajax request it would fail. 

Resolving Image URLs Within MVC StyleBundle

I joined in on an existing MVC project recently, which utilized StyleBundles. The project already had references to stylesheets that I would be using, so I jumped in and started making changes. I wasn't at it long when I noticed that I was getting 404 errors on some of the images that I referenced in my stylesheet. Initially I just thought maybe I made a mistake with the relative path to the image (as I do on occasion), but after some testing I confirmed that this was not the case.

Dependency Injection With Ninject

Collaboration between different modules and services is a crucial part of software architecture in today’s world where business rules become more and more complex and dependent on each other. This leads to some challenges in software development, since the interconnectivity between those modules needs to be modeled and become an integral part of the application design. 

Addressing Emails with an Alternate Address in MS CRM

I recently was programmatically addressing emails in CRM in a custom workflow. (I had to create an attachment to the email using SSRS necessitating a custom workflow.) One of the requirements was to be able to send an email to an email address that contains a contact’s fax number to a special domain.