Dynamics CRM Solution Architecture

Hello readers!

I just completed a series of very animated presentations on Solution Architecture for Dynamics CRM in a few different cities in the east of Canada. I thought I would share the slide deck.

As a summary, I complied a few thoughts about the CRM Solution Architect’s role and typical design consideration. Enjoy the content and feel free to reach out to me with questions and comments.

CRM 2013 – Leveraging Actions to get around JavaScript cross-domain challenges

Last year, I wrote about the challenge of cross-domain calls from JavaScript with CRM 2011. The issue was related to fact that from a security perspective, you could not have JavaScript functions executing on a CRM form event or when a ribbon button is clicked calling web services outside of the CRM domain. I proposed a few workarounds here but the bottom line is that in all cases, there was some sort of a negative impact in each solution. With CRM 2013, actions processes are a great way to get around the browsers’ cross domain restriction.

In this article, I am providing an example of how actions can be used to make a request to a web service outside of the CRM domain from a record’s form event.

Scenario

When users call an incident management center, the agents need to capture the temperature at the time of the incident in the city where it occurred. In order to do so, we decide to create a button on the command bar that agents can click on and that will perform the following tasks:

  • Read the City and Country information from the form
  • Call an Action that
    • Takes the City and Country as parameters
    • Use an external web service to get the temperature in the city
    • Returns the temperature as output parameters
  • Sets the temperature field value on the form

Note: In order to achieve this directly with JavaScript, performing Step 2 of the action would require to make a cross-domain call from JavaScript.

Process Configuration

To start things off, let’s start be creating an Action of type process. This action will have 2 input values (City and Country) and 2 output values (Temperature in Fahrenheit and in Celsius).

The steps are really simple. The action needs to a custom workflow activity that will connect to a weather web service and return the temperature in two output values of its own.

Custom Workflow Activity

Here you can see what the custom workflow activity code looks like. It’s very straight forward in that it only has 3 steps:

  1. Read the city and country inputs
  2. Initialize the web service client object and make the web service call
  3. Set the values back in the output fields to be available in the process

Calling Action from JavaScript

This is the last piece of the puzzle. At this point, we simply need to call the action created from a JavaScript event (ribbon button clicked, on change of a value etc.). In order to achieve this, create a function that is called when the client even occurs. That function should execute the Action, read the output values and set the field values on the form. This has to be done with a SOAP call. There are two ways to do this. You can:

  • use Deepak’s example as show in his blog post here or
  • use the CRM 2013 Sdk.Soap.js action message generator published by the Microsoft CRM SDK team to generate a request and response class you can use in your call to call the action using JavaScript.

Wrap up

This is another great example of how actions can be leveraged to work around challenges that we’ve dealt with in the pre-CRM 2013 era. Keep in mind that in order to call an external web service from the custom workflow activity, there are server security elements to take into consideration (e.g. can my server talk to the web service? etc.)

Hope this helps!

Dynamics CRM and multi-tenancy

It’s a topic that is often discussed and after Microsoft released its whitepaper on it late last year, I thought it would be interesting to write a short summary of some of the enterprise challenges that it addresses.

Definition

Let’s take a look at a few definitions of the term “Multitenancy

Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client-organizations (tenants).” – Wikipedia

Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers. Each customer is called a tenant. Tenants may be given the ability to customize some parts of the application, such as color of the user interface (UI) or business rules, but they cannot customize the application’s code.” – WhatIs.com

Multitenancy is a reference to the mode of operation of software where multiple independent instances of one or multiple applications operate in a shared environment. The instances (tenants) are logically isolated, but physically integrated” – Gartner IT Glossary

Relating these definitions to Microsoft Dynamics CRM, we can view the CRM Server installation as the single instance of the application and the CRM Organizations created on the CRM server as tenants. The tenants are technical groupings within the application, such as separate databases within SQL Server.

Common Enterprise Challenges and Solutions based on Multi-tenancy

Function Localization

  • Description: Provide a common core of functionality, but with local functional variations – with “proper” delegation
  • Example: Multi-national company with business models that vary based on market size, legal compliance or other factors
  • Solution: Using multi-tenancy or multiple instances allows each business area or local region to have an independent implementation with its own local variations.

Master data management

  • Description: Provide a consistent, managed core of information, perhaps distributed only Selectively and enable smooth transitions without big bang replacements
  • Example: You may have an organization that operates in multiple areas and the terms/rules differ from one place to another. These different areas may need to manage their master data independently from one another. In these types of scenarios, it is important to maintain the data that is common across the different components and particularly critical is managing changes to that data. While there are different approaches for accomplishing this goal, many scenarios benefit by having a “master” for certain data sets because it provides for change management through that central master data source (master data management, or MDM)
  • Solution: This approach requires that the central master data be synchronized to all instances so that each instance has access to the latest version of the core information

Physical distribution

  • Description: Mitigate network latency
  • Example: For business solutions that support users that are physically distributed over large distances (global deployments), using a single instance may not be suitable because of the implications (such as WAN latency) associated with the infrastructure over which the users connect.
  • Solution: Distributing instances to provide users with more local access can reduce or overcome WAN-related issues, as the access occurs over shorter network connections

Security/privacy

  • Description: Accommodate legislative/national differences (e.g. patient confidentiality, Swiss banking, third-party use)
  • Example: This is usually a resulting of some sort of legal compliance. For example in Canada, healthcare patient information cannot be transferred from one province to another. If there was a national platform, there would have to be a way to prevent people from access data from patients living in other provinces.
  • Solution: In these types of scenarios, some or all of the data is stored locally, and potentially some of the data is stored centrally

Scalability

  • Description: Accommodate extreme volumes and/or extensive use of Service Scheduling; Provide for isolation of workloads (e.g. web site, customer kiosks)
  • Example: While a single instance of Microsoft Dynamics CRM can scale up and out to support the growth of a customer’s business, with very high data volumes or levels of complexity, there are additional considerations.
  • Solution: for scenarios in which groups of users work independently of each other in operational terms, it may be possible to host the groups on separate Microsoft Dynamics CRM instances and to use reporting to combine results across business areas for management oversight

Multi-tenancy Challenges and Solutions Patterns

The whitepapers has a full detailed section on possible solutions to the challenges introduced by multi-tenancy. These challenges come from the fact that the separation has to be managed. You may want to synchronize your metadata, or expose data from on CRM organization within a different organization.

SSIS Tools for Dynamics CRM

ETL is an everyday subject in medium to large enterprise ERP or CRM project implementations. When it comes to Dynamics CRM, there are many different ways to insert, update and delete data. Using Microsoft’s SQL Server Integration Services (SSIS) is a good solution because of its cost (included in the SQL Server suite), development environment familiarity (Visual Studio, SQL Server Management Studio).

The problem with Dynamics CRM in this context is that its database is not supposed to be accessed directly to read, create, modify or delete data (read operations are OK using Filtered Views). These operations must be done via the application’s API. Fortunately, there are third party tools that provide a “bridge” between SSIS and CRM through custom SSIS components. These tools transform their SSIS components into MS CRM API calls in the background, allowing to perform ETL by using Microsoft’s recommended and supported approach.

Here are some tools that I’ve seen or heard of that will help do your MSCRM data processing with SSIS:

  • Kingsway Soft’s SSIS Integration Toolkit for Microsoft Dynamics CRM
    • Notes
      • Supports CRM 3.0, 4.0, 2011, 2013 and Online
      • Comes with 4 major components: Connection Manger, Source Component, Destination Component, Option Set Mapping Component
    • Pricing Information
      • Free Developer License
      • Single Server Perpetual License @ USD $1295
      • Single Server One Year License @ USD $695
      • Single Server Annual Maintenance and Upgrade @ USD $295
      • Enterprise License – Contact for details
  • RSSBus‘s Dynamics CRM SSIS Components
    • Notes
      • Supports CRM 4.0, 2011 and Online (presumably 2013 as well but no official word on that on their website)
      • Free 30 day trial available
    • Pricing Information
      • Full SSIS Component Subscription (multiple workstation, Royalty-Free distrubiton) @ USD $999
      • Single Machine License @ USD $359
  • Team4 SSIS Connector for Microsoft CRM
    • Notes
      • Supports CRM 4.0, 2011
      • It looks like the product hasn’t been updated in a while given the lack of update on the website
    • Pricing Information
      • Connector is Licenses per server @ EUR 4600
  • CozyRoc Dynamics CRM Source and Destination Components
    • Notes
      • Mature product
      • The web site doesn’t mention support for CRM 2013 (it is supported though)
    • Pricing Information
      • Varies based on the Components you buy
      • Between $400 and $2500
  • Devart’s SSIS Data FlowDevart’s SSIS Data Flow Components
    • Notes
      • Devart has a large portfolio of data integration products
    • Pricing Information
      • Single License @ USD $249.99

 

Cheers!

Silverlight, HTML5 and Dynamics CRM

The Glory Days of Silverlight

Silverlight is Microsoft’s plugin for web-browsers that enables running rich Internet applications, with features and purposes similar to those of Adobe Flash such as multimedia, graphics, animations etc. Shortly after Silverlight was introduced to the market in 2007, Microsoft quickly started to build knowledge around how to write and deploy rich applications and integrate them with Microsoft Dynamics CRM starting at version 4.0.

When you thinking about it, the need for custom UI integration with Dynamics CRM has always been there since the earlier versions. As CRM solution providers, most of us have been in situations where we can come up with a complex data model and we feel like the out of the box UI capabilities won’t be user friendly enough to drive user adoption. Situations like that created the need to build more user friendly interfaces to simply make people’s lives easier when they start using the CRM/XRM application.

To better illustrate, here are a few examples of when we would want to write a custom UI components in CRM

  • Display a tree view of related records with parent/child relationship.
  • Display complex search results: I’m thinking about PowerSearch which is a Global Search add-on for CRM. If you want to search for multiple entity types at once, a custom UI is required to display all results on a single page/view
  • Display timesheets, Gantt project management charts in Professional Services Automation solutions such as Assistance PSA and XRM1 (view screenshots below)

The Decline of Silverlight and the Rise of HTML5

With the emergence of HTML5, it seems we are headed towards a future in which browsers will support HTML5 tags natively thus enable rich content without the need of plugins like Silverlight or Adobe Flash. If some of us as individuals don’t believe this is true, Microsoft and Adobe seem to believe it is since they both dropped or significantly slowed down the evolution of their platforms. Silverlight’s latest major release (version 5) came out in 2011 in a world in which we see companies releasing software solutions at a very fast pace. The emergence of HTML5 have been well documented over the past year. There are still a lot of skeptics out there and that is understandable given how long it’s taking for the HTML5 standard to be completely defined and made available in all browsers.

Dynamics CRM: HTML5/JavaScript or Silverlight

What does this all mean for us Dynamics CRM integrators? The need to have custom UI controls is still existent and it will not go away even with all the new flexibility that we get with CRM 2013. Some data models will always be complex enough to require a better UI to give the solution its best chance of being used. In addition to that, there are still plenty of CRM add-ons built by Microsoft Partners that still use Silverlight 5 as a key piece of their solution. Below is a decision matrix that I came up with for us CRM Solutions providers going forward in making a technology decision when building new UI pieces for MSCRM.

What about the upgrade question? You have Silverlight controls and are wondering if you should built new controls in HTML5 and JavaScript. It’s your decision. Silverlight is not dead, Microsoft is still supporting it and it will for a long time. If you want to learn the new technology and have the time and money to do so, then go for the HTML5 remodeling. Keep in mind that it is a risk given that we have no idea what the lifespan of HTML5 will be.

What about buying an add-on that heavily relies on Silverlight controls? I don’t have a problem with that as long as it’s OK for you to install Silverlight on all client computers. Moving controls from Silverlight to HTML5/Javascript is A LOT of work and represents a significant amount of work for the add-on solution providers. They will upgrade when the time is right for them to do so (hopefully).

Start your CRM Development in Azure!

I attended a presentation by Microsoft TFS ALM MVP Wes MacDonald on Windows Azure  a couple of weeks ago. If you have some level of MSDN Subscription, Microsoft is giving away free $$$ for Windows Azure services.

Knowing that, I decided to use some of my free $$$ to do some CRM development in  Azure. The idea is to create a Virtual machine and just get a feel of the overall experience. To kick things off, we need to activate our Azure Benefits by logging onto our MSDN subscriber account. Navigate to “My Account” and you will see the list of Subscription Services you get based on your level. Click on “Activate Windows Azure” and go thought the activation process. It takes a few minutes.

After that, the rest of the steps are pretty standard. You need to create a VM. There are a couple of options when it comes to doing that.

  1. You prepare your own VM using HyperV and run SysPrep. When that step is completed, you can upload your VM to Azure and boot it…
  2. You can pick from a Template Virtual Machine. In my case, I selected Windows Server 2012 and SQL Server 2012 SP1 (saves me some time)

Once you have done all the steps to create your VM (with Template), you get a RDP file that enables you to connect to your Virtual Machine in Azure. From that point on, it’s standard CRM installation. If you are used to building CRM VMs for development on a local laptop or workstations, typical steps are installing Active Directory, promoting your machine to Domain Controller and installing CRM. It took me about an hour tops to complete the installation (without the development tools i.e. Visual Studio).

For the price and if you are always going to have internet access, it’s much easier to use an Azure Virtual machine for your development. Here are my arguments for doing it:

  • Powerful servers
  • Quick install, fast and easy access (you get to select the data center where you want to VMs to be… Select something close to your location, East US for myself)
  • Possibility to have a separate server for each installation components (SQL, CRM, AD, SharePoint etc…) at a very low cost which you can hardly do on VMs on your local machine
  • Low cost (good discount for MSDN account holders, plus you are only charged when your VMs are running)
  • Azure UI very simple and intuitive
  • Easy integration with Visual Studio 2012 and 2013
  • No need to maintain your own infrastructure and deal with network, hardware and software maintenance

After trying this, I’m leaning towards using moving all my personal development activities to Azure. The cost is low and controllable and it gives me flexibility when it comes to building a better server infrastructure for my CRM Development which I could never have if I work on my laptop (as powerful as it is). Also, it’s worth noting that I am only focusing on infrastructure here but Windows Azure enables you to do much more (Web hosting, storage/backup, mobile, media etc.). If you are looking for a cloud solution, you should take a hard look at Windows Azure!

Cheers

Error Logging Options in CRM

Logging is an often frustrating topic when it comes to Dynamics CRM. How do we manage error logging or even debug and verbose/information logging? The answer from Microsoft is simple and standard: use the ITracingService to write logging information. If your requirements are a little more complex, say you need to track your code execution on a very granular level even if no error occurs, then the ITracingService gives you very little options …

  1. In CRM Online, you cannot activate and review the CRM log files (it’s only available with on premise installations)
  2. In CRM Online, you can view the details that are related to the job execution (works for Asynchronous plugins and custom WF); For synchronous plugins, you only see the logs if an error is thrown by downloading the log file – there is no permanent record of the log
  3. If you enable Tracing in CRM (on premise), there is plenty of system written logs in the CRM trace that makes the log file difficult to read and to find your application specific logs, even if you are using the very nice CRM Log Viewer from Stunnware

If you want to have a custom logging module for CRM code, there are a few things to take into consideration:

  • What kind of information do you need to log?
  • Where do you want/need to write it?
  • How and when do you need to access it?
  • Do you need to control the logging level at a given time? (write error messages only, verbose, info etc.)
  • Who will write the logs? Does that user have permission to write in your chosen location?

Here are a couple of options available to create logs from your CRM code. It is up to the development/architecture team to decide what they want to use that fits their need.

Custom External Logging

You can create logging utilities to write logs in locations other than CRM. For example, you could write logs in the Windows Event Viewer, in a text file or even a custom database. There are also third party tools that help you do that as well (NLog, Log4Net…) if you don’t want to start from scratch. The problem here is that if you are writing logs from plugins or workflow activities that are executed as CRM users, chances are these users won’t have permission to write in your designated location. One option is to simply give access to “Everyone” to these locations but this usually goes against most Enterprises’ IT policies. There are probably ways to set up your log writers to impersonate an admin or user with permissions but I have personally never done it.

Pros:

  • Tailored logging engine built for your needs and in a location of your choice

Cons:

  • Doesn’t work for CRM Online (or not easily)
  • Requires system users to have permission to write the logs in the selected location

Custom CRM Entity

Another way to do this is to create one (or many) custom entity to capture your logs. Your CRM custom code can just create new rows in the table(s) to log the required information/error.

Pros:

  • Works for all CRM Installation;
  • Security is simple to manage;
  • Logging information is available directly in CRM;
  • Custom entity can be customized to capture specific logging fields

Cons:

  • Depending on the amount of logging required, your log table(s) may grow really quickly. Think about having a mechanism to clear all unnecessary or outdated logs on a regular basis
  • If you are writing logs in a failing transaction, the entire transaction will be rolled back including creation of logging records. Check out a workaround for this issue here.

These are just a few thoughts on logging and as always in technology, there are probably plenty of other things we can do around logging in CRM. Thought this could be helpful. Feel free to reach out if you want more details or guidance on the topic.