Government 2013

Volume 28 Number 10A

Dynamics CRM - Building Government Business Applications with Microsoft Dynamics CRM

By Marc Schweigert | Government 2013

When developers evaluate technologies for building government business applications, Microsoft Dynamics CRM may not be the first to come to mind—but maybe it should be. Build your application on Dynamics CRM and experience shortened time-to-value because of the many platform features that limit the amount of code you’ll need to write. Enjoy out-of-the-box enterprise scalability, reduced maintenance and enhanced agility for business users.

A significant and increasing number of organizations across the U.S. federal, state, and local governments, as well as the health-care and education verticals, have been doing just that. They’ve been using Dynamics CRM as a custom development platform to solve business problems. The solutions they’ve built vary widely. Some examples include:

  • Planning mission and workforce readiness for the military and national security agencies
  • Ensuring veterans receive benefits
  • Tracking prison inmates
  • Managing government benefits and assistance coordination
  • Managing student retention in education
  • Coordinating care for people with developmental disabilities

While these solutions span a variety of use cases, they’re united by a set of common characteristics that Dynamics CRM is uniquely qualified to provide. So let’s start with you—because chances are, as a person tasked with building a government business application, you need to produce an application with these same characteristics.

Your Problems

  • UI: Your application needs to give users data-entry forms that represent relational data (people, places and things).
  • Business Logic: Your requirements demand data validation, complex logic and algorithm execution, and so forth.
  • Business Process Automation: You’re tasked with automating processes that span long periods of time and might have complex steps. These processes previously relied on human effort to complete.
  • Business Intelligence (BI): You’ve been asked to produce reports from your application’s data that yield insights that improve your organization’s performance.
  • Enterprise Scalability: Your application will be deployed to a pilot group of users at first, but eventually it will host thousands of users. You need to be able to handle growth from a small infrastructure of one or two servers to a large server farm over time. Buying all the hardware right now isn’t an option. 
  • Document Management and Storage: Your organization projects that paper forms will play an important role in operations for the foreseeable future, but it wants to store the forms digitally. Additionally, other forms exist that can be filled out digitally, but can’t be converted to Web forms over a database, so you need to store the document in its entirety.
  • Granular, Role-Based Security: Security is important in the government. You need to ensure that when User A logs in, he can see or do certain things, and when User B logs in, she can see and do different things.
  • Mobility: The end users of the system have been begging for something mobile so they can move through the office with the people they’re helping, without having to log into different PCs at various locations.
  • Integration with External Systems: Admit it—you’ve got legacy systems. There’s still important data in these other systems, and you’re not going to migrate it out all at once. Your application needs to be capable of integrating with other systems to share, move or view data.

So, what does this have to do with customer relationship management (CRM) and salesforce automation? Let’s talk about CRM, and about how you’re going to accomplish all of this with Microsoft Dynamics CRM.

Your Platform

First, let’s look at why Dynamics CRM is capable of meeting the unique requirements of your application—because it certainly did start out as an application designed to manage a company’s sales, marketing and customer service data. But there are as many different ways to do these activities as there are companies that do them. So Microsoft built Dynamics CRM with the ability to flex and meet various customer needs.

Moreover, the efforts of these departments are rarely carried out in isolation. There are other departments doing related activities, regularly moving in and through the work stream of the sales, marketing and service departments. Customers want to track this data as well, but it doesn’t fit in the enterprise resource planning (ERP) applications being used. So Dynamics CRM provides the ability to be even more flexible. In the end, this flexibility enables data to be used for purposes that have nothing to do with sales, marketing or service. Using Dynamics CRM to address these custom use cases is typically referred to as Extended CRM. More commonly, the community of people who build these solutions affectionately call it XRM.

We’ll discuss the ways Dynamics CRM can be extended later in this article, but its core customization feature is its extensible data schema. Without writing code, you can create custom data objects (called entities) and attributes, and create custom relationships between the entities. These entities represent people, places, or things, similar to the types or objects you’d create in code. Every entity created has one or more forms for data entry, and data grids for viewing and filtering lists of entity records. These forms and grids are automatically included in the security model, allowing them to be configured with role-based security. Charts can be created and added to custom dashboards that visualize data about the entity for users. Finally, all of these customizations can be packaged in an exportable container called a “Solution,” which can then be archived or imported into other deployments of Dynamics CRM.

Now that you’ve been briefed on Dynamics CRM, let’s see how the requirements can be met for your application.

Debrief: Windows Azure Security

Microsoft Dynamics CRM is being used by government organizations in the United States and across the world to build business applications. This article discusses why Dynamics CRM is a great platform for government business application development.

IT Brief:

The cost of building a business application from scratch is likely to be greater than using Dynamics CRM as a platform. Consider the following benefits:

  • Shortened time to value because of the many platform features that limit the amount of code needed.
  • Enterprise-ready with security and scalability.
  • Maintenance and modernization of the platform performed by Microsoft.

Dev Brief:

Dynamics CRM is a platform for developing custom business apps. Developers can accomplish many tasks that would have previously required intensive code with simple configuration in Dynamics CRM, and focus code-writing efforts on solving more complex business challenges.

  • Security is part of the platform.
  • Forms and grids in a modern UI come standard, with no programming code. 
  • Programming code can easily achieve complex business logic, integration with other systems and customization of Dynamics CRM forms.

More Information:

UI

You need a customizable, attractive front end for your users. Let’s face it—a lot of the applications users see are ugly enough to make them pucker. Giving them an application that looks cool might change their lives, save their marriages, improve their neighborhoods and stop global warming.         

The UI of Microsoft Dynamics CRM, shown in Figure 1, is Web-based and built on ASP.NET. As with all ASP.NET applications, the CRM Web server sends HTML, JavaScript, CSS and images to the browser that renders the UI. Whether you’re using Dynamics CRM through a Web browser or the Outlook add-in, the majority of the UI you see is HTML-based, with the exception of a few places in the Outlook add-in. However, even in the add-in, objects such as forms are simply surfaced in Outlook through a browser frame. In offline mode, those Web pages are served through a lightweight Web server running on the client computer.

The Microsoft Dynamics CRM UI
Figure 1 The Microsoft Dynamics CRM UI

The primary mechanism for extending the Dynamics CRM UI is something called a “Web resource” (for an example, see the map control in Figure 1). Web resources are simply HTML, JavaScript, CSS, images or a few other endorsed file types that a developer can upload to Dynamics CRM. After you upload Web resources, Dynamics CRM will serve HTTP requests for those files from the Dynamics CRM Web servers.

Dynamics CRM exposes both SOAP and REST Web services that can be called from JavaScript. The SDK contains a series of samples and helper libraries to help you do so. Because you’re working in good old HTML/JavaScript/CSS, by calling Web services you can pretty much do anything that’s possible with those technologies in the context of your XRM application.

However, there is one caveat. The rule of thumb with Dynamics CRM—or with any server product that produces HTML and allows for extending the UI—is that you may not modify the UI the server sends to the browser using HTML Document Object Model (DOM) manipulation or libraries such as jQuery. However, if you created the HTML, you can perform DOM manipulation all you want. The CRM SDK covers this in more detail. The SDK also provides a JavaScript library, typically referred to as Xrm.Page, which is a layer of abstraction on top of the HTML UI that enables, for example, interacting with controls and data on Dynamics CRM forms.

HTML5 So what about HTML5? As long as the browsers rendering the Dynamics CRM UI are HTML5-capable, your applications can take advantage of it. Because you can upload JavaScript files to the server, you can deploy popular third-party JavaScript libraries to Dynamics CRM as well.

Once you understand that the core UI extensibility of Dynamics CRM is just HTML/JavaScript/CSS together with Web service calls to interact with the server, and you understand that Web resources are just those assets uploaded to the server and served back to the browser through the same Web servers that serve the CRM UI, all sorts of “aha!” moments about how you can extend the CRM UI begin to occur.

Note that Web resources are protected by the various authentication mechanisms supported by Dynamics CRM. As a result, they won’t be served by the Web server unless a user has logged in.

To bring together all the concepts discussed so far, consider the following example:

Imagine a completely customized jQuery Mobile-based UI that uses HTML5 geolocation APIs to get a user’s latitude and longitude, then stores that location as a record of proof that a field worker was where he was supposed to be at the time of a field service appointment. The field worker’s simple task would be to navigate to a URL using a browser favorite and then log in. That URL would be, as you might have guessed, pointing to an HTML Web resource that provides a completely custom UX using HTML/JavaScript/CSS. After the user logs in, the UI calls the CRM Web services to retrieve and save data. On the CRM platform, all custom business logic, workflows, and role-based security that had been configured would be executed or enforced in response to any Web service requests. This example, though simple, demonstrates the power of using Dynamics CRM as a platform to build business applications.

Business Logic

There are multiple tools in Dynamics CRM for designing business logic. Your requirements include data validation, complex logic and algorithm execution. Let’s talk about some tools you can use to knock this one out of the park.

Plug-Ins Plug-ins are server-side logic, written in C#. They execute in relation to database transactions, and can be configured to execute before or after a transaction. They can be configured with filters that keep them from running when the attributes of an entity being passed to the database don’t match the desired conditions, so that they don’t cause too much overhead. Plug-ins provide an extensive set of capabilities, allowing access to almost everything in the SDK. 

Actions Actions are new in Dynamics CRM 2013, which is slated for release this fall. Before Actions, you couldn’t execute arbitrary server-side business logic—you could only write server-side business logic that reacted to events related to Dynamics CRM entities. Actions are a way to define arbitrary business logic. You can think of Actions as a declarative way to author the equivalent of a function or method call, complete with input and output parameters. Actions are exposed through the Dynamics CRM SOAP Web service. Therefore, they’re callable from Web resources, other Dynamics CRM extensibility points that can execute custom code and outside callers. Common scenarios in which Actions might be used include “Escalate,” “Approve” or similar activities.

Actions have an added bonus in that they enable a business analyst to compose server-side business logic without writing code. They’re written using the same designer used for authoring workflows. Therefore, all facilities available to the workflow designer, including custom workflow activities, are available for Actions. Actions are a powerful new extensibility point in Dynamics CRM 2013 that are sure to be leveraged in interesting ways.

Workflow Another configuration that a business analyst can create without code is a workflow, a server-side business logic routine that can be triggered manually by a user, or by a system event such as the update or create event associated with a type of record. Dynamics CRM 2011 allowed only for asynchronous execution of workflows. As a result, there were lots of areas in which code was required to solve a problem if the logic needed to be executed synchronously. Dynamics CRM 2013 adds support for synchronous execution of workflows, which will have the net effect of reducing the need for custom code.

Portable Business Logic Finally, business analysts can declaratively configure business logic that executes on the Web forms for Dynamics CRM records. Earlier versions of the product required JavaScript to accomplish these actions, and a much broader set of actions is still available for those willing to write script. However, the following key capabilities represent some of the most commonly implemented logic on forms:

  • Validate data entry and throw errors
  • Perform simple calculations (+, -, *, /)
  • Show/hide fields
  • Enable/disable fields
  • Set field values
  • Make fields required or recommended

The ability to perform these actions without having to write code reduces the amount of script needed to deploy many solutions. In addition, by empowering business analysts to create this type of logic without the assistance of developers, Dynamics CRM helps customers be more agile and able to quickly support rapidly changing business needs with technology solutions. Despite the high value of this type of feature, it would rarely pass the cost/benefit analysis and be included in plans for an application developed from the ground up. With Dynamics CRM, this functionality is already part of the platform.

Business Process Automation

You need to automate a process whose inefficiency is wasting millions of dollars every year. Let’s talk about a no-code solution that can help your people follow the process and collect the right information as they do so: process flow. The process flow allows the person doing the configuration to create stages in a process for a type of record, such as a customer service case. The person can then put different fields in the stages, declare whether the fields are required before moving on to the next stage, and thus ensure that end-users consistently follow the correct process and collect the correct data. The end result is what you see in Figure 2.

A Dynamics CRM Record with a Process Flow on the Form (the Process Flow Is the Area Immediately Below the “Problem in neighborhood” Title)
Figure 2 A Dynamics CRM Record with a Process Flow on the Form (the Process Flow Is the Area Immediately Below the “Problem in neighborhood” Title)

With the other types of business logic customizations we’ve mentioned, you can run algorithms, more complex logic, and even reach out to get data from or push data to other applications via Web services when certain parts of the stage are completed.

Business Intelligence

So you have these requirements to provide certain key data in reports. Were you to build this application from the ground up, you’d have choices about how to meet this objective, but none of them would be trivial. Using Dynamics CRM as the platform for your application, you also have choices, and some of them are trivial.

A presenter in a session on Dynamics CRM in health care recently made the point that while we’re all intrigued by the concept of big data, we shouldn’t overlook the fact that what most end users really need is small data to help them make everyday decisions. Whether your BI game plan involves using data from a data service, gathering ambient data from sensors to combine with the transactional data in Dynamics CRM, or simply organizing insights from the data you track in your application, there are several viable ways to get the data out of its transactional resting place and into more dynamic, visually appealing formats for deeper analysis. Plenty of material already exists that covers the standard Dynamics CRM BI experiences, which include building SQL Server Reporting Services (SSRS) reports, charts and dashboards.

Rather than describe these standard capabilities in this article, we’ll focus on some of the lesser-known ways you can leverage Dynamics CRM and surrounding Microsoft technologies to allow for deeper analysis, in particular the Microsoft Office tools that allow you to perform self-service BI—Power Pivot, Power View, Power Map and Power Query.

Microsoft Office is perhaps the most powerful companion to Dynamics CRM. The integration with Microsoft Outlook is the most prominent aspect of this, but integration between Dynamics CRM and Office is far more pervasive than this single feature. The BI tools discussed hereafter are made possible via recent advances in Excel data visualizations. Together with the “Export to Excel” feature that has been in Dynamics CRM since early versions, these features enable a level of visual data analysis that wasn’t previously possible.

Power Pivot An Excel add-in that allows you to combine data from different sources into one data model in Excel. This in-memory data-processing tool can work through huge volumes of data for analysis without showing any sign of lag. The ability to analyze so much data so quickly, combined with the rapidly increasing availability of public and enterprise data, opens the door for some interesting data exploration and analysis.

Power View A data-visualization tool that runs inside of Excel. In a process similar to building pivot tables and pivot charts, you can organize data into axes to create beautiful reports that make trends in the data easier to spot.

Power Map Similar to Power View, except the visualizations are all map-based. When your data has a geographical dimension, throw it into Power Map and see the data laid out across geographical space.

Power Query A data-import tool right inside of Excel that can pull data out of XML, JSON and OData Web APIs. It can even rip data out of HTML tables in Web pages. If there’s any supplemental data that you want to sprinkle your Dynamics CRM data with for greater insight, Power Query can help.

Why are we talking about Excel so much in an article about Dynamics CRM? Because when you build your government business application on Dynamics CRM, you can get data from your application to Excel with the push of a button. And with the ability of Excel to refresh its data from Dynamics CRM, you can build your Excel BI tool once and get new data from your application every time you open it. You can even take the Excel file and put it in your application’s reports area, so your users can open the file right from the Dynamics CRM interface.

Let’s get down to details. Imagine your agency requires you to prepare a report that shows the satisfaction levels of the customers of the agency’s field offices. Maybe the agency just asks for a static report, or maybe it wants the ability to explore the data. In either case, you decide to over-deliver on this requirement, because it’s so easy to provide more information. Not only will your agency have a report it can explore a little bit, it’ll also have a full self-service BI tool that will give it insights it never thought possible.

So how do you start implementing this solution? You’ll need to get your transactional data schema set up in your application, which is also a prerequisite for users to start generating data. Once that data exists, you’ll export it to Excel.

Once you have the data in Excel, you’re free to do whatever you want using the tools listed earlier. Use Power View and Power Map to lay the data out in visually stunning formats that yield much more nuanced insights than a table or simple chart.

For example, one of the most interesting and insightful data visualizations available in Power View is the scatter diagram. In addition to the X and Y axes and the bubble-size axis, a scatter diagram provides a “play axis” that contains a dimension by which the measures will be animated when you push the Play button. The most obvious data to use in this axis is time. Put an appropriately scaled set of time values in the play axis, press Play, and watch how the bubbles change size and position over the time span in your dataset, visualizing trends and relationships in the data that would’ve been difficult to recognize in a simple pivot table.

Now, let’s say your field office has a call center that handles complaints and requests over the phone. Your requirements dictate a report that shows the satisfaction levels for each call center operator. With the Power View scatter diagram, you can put the satisfaction, urgency, and call center operator columns in the axes on the chart, and the time column on the play axis. Then, the users of this report can watch how the satisfaction increases or decreases over time for each user as the urgency of the cases fluctuates, as shown in Figure 3.

Example Power View Report Showing a Scatter Diagram with a “Play Axis” at the Top Right
Figure 3 Example Power View Report Showing a Scatter Diagram with a “Play Axis” at the Top Right

Or, suppose in the past you would’ve created a pivot table and chart that break down the data by geography, giving you collapsible row groupings and bars that contain data for different geographical areas. But if you have a lot of these areas, understanding what’s different about the data in the areas doesn’t exactly jump out at you. You may do better by using Power Map, which can plot the values out graphically on a map control to help you identify where your values are large, where they’re small, and what trends might exist geographically.

For example, a well-grouped pivot table or chart might show you that values in the West are generally higher than those in the East, but it wouldn’t necessarily show you that values in coastal areas are much higher than those in inland areas. Power Map makes it much more intuitive and efficient to explore, identify, analyze and share insights about trends in data including a geographic dimension. Figure 4 shows an example.

A Sample Power Map Report
Figure 4 A Sample Power Map Report

Finally, let’s suppose you need to supplement the data from your application with other publicly available data. Specifically, you need to compare how the satisfaction of customers is related to whether their county voted Republican or Democrat in the last election. You find the voting data online, and you use Power Query to pull it into Excel. You use Power Pivot to create the relationships between the voting data and the data from your government business application. The voting data is now part of your data model, and you can include it in your data analysis and visualization in the same manner in which you’ve reported on the data that came from your application.

The integration with Excel and the self-service BI tools we’ve described allows you to put BI in the hands of your users more easily than ever before.

Enterprise Scalability

Your application is going to start with a small pilot, but within a few years, it will host thousands of users. If you build your application on Dynamics CRM, you’ll benefit from its highly scalable architecture, which enables installation in a wide range of infrastructure configurations. The scalability of Dynamics CRM is a topic worthy of its own article, but you can get an overview by reviewing the TechNet Library white paper, “Microsoft Dynamics CRM 2011 Performance and Scalability on Intel Processor-Based Servers with Solid-State Drives,”at technet.microsoft.com/library/hh204514.

Whether you build your application on the version of Dynamics CRM that runs in your own on-premises environment or leverage the Microsoft Software as a Service (SaaS) offering called Dynamics CRM Online, the same building blocks are used to scale out the deployment, because Dynamics CRM Online runs the same codebase you install in your own datacenter. This brings up another enormous benefit of using Dynamics CRM to build your application: By following some simple design principles, you can ensure your application will be portable across on-premises and online deployments.

Document Management and Storage

Out of the box, Dynamics CRM integrates with SharePoint by enabling documents in SharePoint to be associated with relational data in Dynamics CRM. To accomplish this, Dynamics CRM stores metadata about SharePoint folders that contain documents related to records in Dynamics CRM.

Although it appears to end users that the documents are stored in your application, they’re actually stored in SharePoint behind the scenes. This means you can take advantage of all the inherent document-management capabilities of SharePoint (version control, document templates and the like). However, many customers and partners implement much more advanced integrations of Dynamics CRM and SharePoint by leveraging the SDKs for the two products in concert. This opens up numerous integration possibilities, as the following examples indicate:

  • Automation of document library creation and custom document library folder structures
  • Attaching Dynamics CRM data as metadata to documents in SharePoint
  • Advanced mapping of the Dynamics CRM security model to limit access to SharePoint documents
  • Surfacing Dynamics CRM data in SharePoint using Business Connectivity Services (BCS)
  • Indexing and searching relational data in Dynamics CRM through SharePoint to provide a more Bing-like search facility

Granular, Role-Based Security

Your users aren’t all the same. They perform different tasks and have different responsibilities, and in a government organization where security matters, it’s important to ensure each user can access only the information required for his job. If you build your application from scratch, you’ll need to figure out how to handle this security requirement, including how to make it easy to administer and how to address various exceptions that might arise in the course of business.

If you build your application on Dynamics CRM, you start your project with a granular security model. Your application will also have tools to handle security exceptions, such as record sharing, teams and team ownership, and team-selling features, all of which enable your users to design a security model that can meet stringent demands. For scenarios that require even more unique security rules, your application can use the Dynamics CRM SDK to further control data access by your end users.

Mobility

Because the new modern Dynamics CRM UI is touch-friendly, it works as well in a desktop Web browser as it does in the built-in browsers for iPad, Android and Windows 8 devices. If you want to go from touch-friendly (Figure 5) to touch-optimized (Figure 6), however, there are two possibilities. The first is the mobile application that comes with Dynamics CRM 2013. The second is building a custom mobile app.

A Touch-Friendly Web App
Figure 5 A Touch-Friendly Web App

A Touch-Optimized Native App
Figure 6 A Touch-Optimized Native App

Native Mobile App The trend in many industries toward a mobile workforce gave Microsoft the opportunity to develop a modern, streamlined application customized for the tablet experience. This application is available for Windows 8 and iPad devices, and it contains a set of high-value capabilities that cover the most likely tasks to be performed in a mobile scenario. For those building government business applications with a mobile component, this is another powerful platform benefit that speeds time-to-value by reducing the amount of work required by developers. In many cases, this new native mobile app eliminates the need to write a custom tablet app for XRM solutions. However, there will still be cases in which building a custom app will be a more appropriate solution.

Custom Mobile App If you’re reading this article, you probably already know about the popularity of REST and OData with mobile developers and about the importance of OAuth in securing RESTful APIs, including OData. While Dynamics CRM 2011 exposed a RESTful OData endpoint for create, read, update and delete (CRUD) operations on CRM entities, it didn’t have a supported mechanism for allowing external callers to interact with the OData service endpoint. Dynamics CRM 2013 brings full support for OAuth through Windows Azure Active Directory (WAAD) in Dynamics CRM Online and through the version of Active Directory Federation Services (AD FS) that ships with Windows Server 2012 R2. As a result, an OData endpoint is now available to external callers, exposing basic CRUD operations.

Together, these technologies provide a much-improved interoperability story for Dynamics CRM 2013, a story that includes a greatly enhanced developer experience for writing custom Windows Store apps and Windows Phone applications that use Dynamics CRM as their application server.

Integration with Other Systems

You run a lot of legacy applications in your organization—that’s just the way it is. While you’d love to see these applications make way for newer applications across the infrastructure, you know that many of them will live as long as a tortoise. The data in these applications is complementary to the application you’re building, and you need to integrate the two systems.

Built on Dynamics CRM, your application has a fanny-pack full of integration capabilities. These begin with the Web services and the SDK and end with third-party tools that allow you to set up integrations fairly easily. Your choice in executing this requirement depends on the nature of the legacy applications and the type of data in the legacy systems.

Wrapping Up

Our intention in this article was to demonstrate the many reasons why you should consider Dynamics CRM when evaluating technologies for building a government business application. It offers a powerful platform for building a wide range of apps, and offers many benefits for developers that result in a shortened time-to-value. With the release of Dynamics CRM 2013, applications will benefit even more from an improved modern UX, tablet mobility and new platform capabilities.


Marc Schweigert is the chief architect of the U.S. Public Sector Dynamics team at Microsoft, where he has technical oversight of the pre- and post-sales solutions that Microsoft federal, state and local government, education, and health-care customers and partners are building using Dynamics CRM.

Andy Schultz loves reading, writing, learning, getting better at things, and participating in the advancement of the capabilities of humanity through technology. He’s a husband, the dad of four, a BYU alum, and a technical architect focused on the public sector at Microsoft.

Thanks to the following Microsoft technical experts for reviewing this article: Girish Raja (girishr@microsoft.com) and Jim Toland (jtoland@microsoft.com)