Apr
1
2011

Unit testing Microsoft Dynamics CRM code

If you're developing code that runs against Dynamics CRM, you know you should be testing it, right? As a developer first and foremost, I always believed that tests and documentation got in the way of the important - and more fun - stuff, but as I transitioned into a management role with responsibility for my company's Dynamics CRM system, I began to appreciate the value of the less-fun stuff.

In this post I'll give you an overview of our continuous integration environment and offer a conceptual example of how to unit test your CRM code without having to execute tests against a running CRM system.

Our full build and unit testing process used the following:

Whenever a developer made a commit to SVN, CC.NET would execute the correct NAnt build target (different ones for production, testing, etc.), then it would run the NUnit tests. The results of the build (broken/successful) and the results of the NUnit tests were all reported through the CC.NET web interface so you could see a historical view. CC.NET also has a desktop notification app that is green when all builds are good or red when all builds are bad that you can use to easily check up on your development team.
More...

Mar
21
2011

Dynamically setting field requirement levels in Microsoft Dynamics CRM

In Dynamics CRM you may have a field you want to be required some of the time, but not required, or maybe not even enabled, the rest of the time. In this post I'll show you how to dynamically enable/disable and set/unset the required attribute of CRM form fields using JavaScript.

Let's say you have a delivery restaurant that sells pizza and wings. You could store the order attributes in CRM on a custom DeliveryOrder entity. You could have a picklist to represent the order type, pizza or wings, and you could store the pizza toppings in a text field. If the order type is pizza, you want to require something be entered in the toppings field. If the order type is wings, you don't want to even allow an entry in the toppings field.

More...
Mar
17
2011

Using internal rate of return to evaluate technology projects

One of the most basic and most important functions of technology management is to evaluate projects to determine whether your organization should invest time and resources in them. As fundamental as this function is, too many people do it the wrong way. I initially wrote a draft version of this post that outlined a variety of wrong ways to evaluate projects, but I gave up on it because it was too depressing. Instead of that, let's get right to it. The best practical way to evaluate technology projects is to calculate the proposed project's internal rate of return. In the rest of this post, I'll explain what the internal rate of return (IRR) is, show how to calculate it, point out a few technical caveats, discuss some real-world considerations and offer a sample spreadsheet that you can use for your own projects.

More...

Mar
15
2011

Activity coding in Dynamics CRM

At a previous job, we had used GoldMine (version 6.7 was where we parted ways) as our CRM system before moving to Dynamics CRM. At the time - maybe it's still done this way - GoldMine allowed you to code activities with a hierarchy of references, codes and results. We used reference to separate activities either by department or broad functional grouping (e.g. "service" was a separate reference although there was no separate "service" department). Codes were the specific kinds of activities or client touch points grouped under a reference, and the results indicated how the activity concluded.

The reference/code/result structure allowed us an incredible level of granularity for tracking all the times we either interacted with an external stakeholder (client, prospect, partner, external service provider) or did something on its behalf. We were able to compile detailed "production" reports for our call center reps, and the activities' structure gave them a framework for approaching their routine daily responsibilities.

Here's a simple reference/code/result example:
Reference - Sales
Code - 1PC//Prospecting call (In GoldMine everything before the // was treated as the picklist entry's primary key, so the 1PC would be stored in the database. We would then speak of 1PC calls as a shorthand.)
Result - 1LM//Left message

We tracked everything this way. Despite us still using GoldMine 6.7 in some parts of our business all the way into 2008, activity tracking was great except for two problems. First, although the codes existed in our processes as a logical hierarchy, GoldMine didn't understand that. If you picked the "sales" reference, you still had to weed through all the codes and results that corresponded to all the other references. Second, adding new reference/code/result entries in a supported manner took a lot of time.

When we started considering the move to CRM 3 in 2005, I found the default activity entity structure to be something of a letdown, so I brought the reference/code/result framework over when we actually did move. Here's how I did it.
Jun
2
2010

A macros system for Dynamics CRM - part three

In part one of this series, I explained the basic idea behind a macros system for Dynamics CRM and a situation in which you'd want to use it instead of a workflow for process automation. I explained the structure of the macros system and showed the CRM entity form customizations that are required to implement it in part two. In this final part I'll show the ASP.Net code that does the heavy lifting for our basic policy renewal example.

The macros page
As I mentioned earlier, we use an ASP.Net Web Forms application to run the macros system, so we need to create a .aspx page for the policy macros. Because we believe in separation of business logic and presentation, our .aspx page requires two separate files, the .aspx page itself and its code-behind.

Our .aspx page has two sections. First, there is the list of links that trigger the various macros. It looks something like this:
<asp:LinkButton ID="renewLinkButton" CssClass="text" runat="server" OnCommand="RenewPolicy" CommandArgument="Renew">
Renew policy
</asp:LinkButton>
<br />
<asp:LinkButton ID="anotherLinkButton" CssClass="text" runat="server" OnCommand="SomethingElse" CommandArgument="Renew">
Another macro
</asp:LinkButton>
More...
May
24
2010

A macros system for Dynamics CRM - part two

In part one of this series, I explained the basic idea of what a macros system for Dynamics CRM is and a situation in which you'd want to use it instead of a workflow for process automation. In this post I'll explain the structure of the macros system and show the CRM entity form customizations that will be required to implement it.

As I mentioned in part one, the idea underlying the macros system is that a user can trigger several distinct steps by clicking a single hyperlink. We achieve this by showing the user, via an iframe on the entity form, a page of hyperlinks specific to a given entity type. The macros page will also need to know the specific entity its actions will target. This requires the following:

  1. An iframe on the entity form in CRM.
  2. JavaScript code to load the macros page in CRM. (This isn't strictly required, but you'll get ugly errors in the create entity form if you specify the iframe URL directly.)
  3. A separate Web page per entity that will offer macros to do the work.
In this post I'll outline the first two steps, and I'll show sample code for the macros page in part three.
May
20
2010

A macros system for Dynamics CRM - part one

Workflows in Dynamics CRM can do a lot, but a significant limitation is that they're asynchronous. If you need to automate server-side code execution and interact with the user at the same time, you're out of luck. This is where you can use something that I call a macros system.

This is the first of a three-post series in which I will:
  • outline a business problem that a macros system can solve
  • give an overview of the structure of our CRM macros system 
  • share some sample code for how to implement a basic set of macros for a CRM business entity.

More...
May
17
2010

The problems with xRM

For the past year or so, I've been hearing the Microsoft Dynamics CRM community talking about the concept of xRM. Supposedly xRM is the idea that you can do all sorts of custom development on top of the MS CRM platform instead of using it just for traditional CRM kinds of tasks.

To that I say, "big deal."

To clarify, I think that using MS CRM as a platform for custom development is generally a good thing. I started doing it with CRM 3.0 back in 2006, and today my company runs almost entirely on top of a heavily customized MS CRM 4.0 installation - sales/customer service/commissions receipts/contract management/etc., but I still hate the idea of xRM for four reasons.
More...
May
17
2010

You can't always get what you want

I was going to kick off my new blog with an inspiring post about who I am and what I believe and why you should care about what I have to say. Then I realized that was lame. You'll decide whether you want to be here based on the utility and/or entertainment value of what I share, not some rambling manifesto. So, without further adieu, let's jump right into things . . .

As a young, and admittedly brash, Web developer, I found myself working on a project that went through several distinct iterations, all but one of which were considered failures by the majority of the stakeholders. This project was my company's first foray into the exciting world of e-commerce, and during the heady days of late 2000 to mid-2001, it seemed complicated, wonderful, scary and exhilarating all at once. I can't name names, but let's call it Project Paperweight - anyone who knows what I'm talking about will understand.

About the author

I work with information systems, mainly Microsoft Dynamics CRM, C# development and SQL Server. Technology is OK, but using it to run a business better is even more interesting.

Month List