Microsoft Dynamics CRM multi-tenancy addresses Business Challenges

December 7, 2012 1 comment

Microsoft announce the release of white paper, Using Multi-tenancy in Microsoft Dynamics CRM 2011 to Address Challenges in Enterprise Business Environments, which is available for download from the Microsoft Download Center at:

There are a number of complexities associated with implementing large-scale CRM projects in Enterprise business scenarios. In these situations, using multiple tenants in Microsoft Dynamics CRM 2011 can help to address several typical challenges, which include:

  • Functional localization, for organizations with different business units or areas that have varying business requirements or processes
  • Master data management, for organizations that need to distribute but maintain control of business data in certain ways
  • Physical distribution, for organizations with user base that is physically distributed in ways that introduce challenges such as distance of connections
  • Security and privacy, for organizations that need complex control of distribution or access to data
  • Scalability, for organizations with workload requirements that exceed or are prohibitively costly to host within a single system

Microsoft Dynamics CRM offers a variety of capabilities that allow customers to implement rich solutions to address complicated business requirements, which tend to have an even higher degree of complexity for customers in the Enterprise. For solutions that incorporate multiple instances of Microsoft Dynamics CRM 2011, a second major consideration is any potential need for integration or interaction between the different instances in the overall business solution.

This white paper discusses scenarios in which using multiple instances of Microsoft Dynamics CRM 2011 to separate areas of functionality can assist in addressing business challenges in the Enterprise. The paper also describes some common approaches for integrating multiple, separate instances of Microsoft Dynamics CRM 2011.

Categories: Microsoft Dynamics

Microsoft CRM Online and Office 365

December 7, 2012 Leave a comment

Microsoft announce the release of Trial Guide:Microsoft Dynamics CRM Online and Office 365, which is also available for download from the Microsoft Download Center at:

The guide is designed to be used as a real-time road map that provides step-by-step instructions to quickly demonstrate how to integrate Microsoft Dynamics CRM Online and Office 365 to improve office collaboration, staff productivity, and organization agility through Microsoft’s cloud-based services.


Categories: Microsoft Dynamics

Building clients for Windows 8 RT

November 10, 2012 Leave a comment

The Microsoft.Xrm.Sdk.dll library provided as part of the Dynamics CRM 2011 SDK makes it easy to write  .NET applications that target the desktop. This library has dependencies on .NET 4.0 and Windows Identity Foundation (WIF), neither of which are available for Windows Phone and Windows 8 RT platforms. Although the WS-Trust protocol used by Dynamics CRM 2011 for authentication is fairly well defined and several folks have built implementations for other languages/platforms, we want to make it easy for you to build amazing applications on these platforms , so a reference implementation of the CRM SDK for these platforms is provided here. Unlike the desktop version, where we only provided you with the binary assembly, we have provided the complete source code, so you should be able to make changes to fit your specific needs.  Please note that this works for Dynamics CRM Online deployments, both Office 365 and Windows Live ID, and for Internet Facing Deployments (IFD). It does not work for Dynamics CRM on-premises deployments using Active Directory authentication.

This code is provided “as is”, so you are responsible for making any fixes.

The rest of this post describes how to use the code to authenticate and send web service requests.

Authenticating to the CRM Web Services

Use ServiceConfigurationFactory to construct a DiscoveryServiceConfiguration or an OrganizationServiceConfiguration object. These classes load the relevant metadata and raise one of these events:

  • MetadataLoaded event if the service metadata has been loaded successfully
  • MetadataLoadFailure for other failure cases, such as when the endpoint is not reachable

Once the metadata has been loaded, you can call the Authenticate method. On completion, the Authenticate methods raise the SignInComplete event. The SignOnCompletedEventArgs object on the event callback contains the returned token in the Result property on successful authentication, and contains a non-null exception in the Error property in the case of failed authentication. You can use the returned token to call CRM web service methods.

Windlows Live ID authentication requires device authentication to be performed first, in which case the authentication flow is AuthenticateDevice -> DeviceSigninComplete event -> Authenticate -> SignInComplete event, which can be achieved as shown below:

  1. Attach to the DeviceSigninComplete event and do the following in the event handler:
    1. Handle any error in device authentication by examining the SignOnCompletedEventArgs.Error property. If there is no error, continue with the following
    2. Attach to the SignInComplete event for the user authentication. In the handler, handle any error/read the returned token
    3. Call Authenticate(ClientCredentials clientCredentials, RequestSecurityTokenResponse deviceSecurityToken) passing in the user credentials and the returned token response from device authentication
  2. Call AuthenticateDevice passing in the device credentials to trigger the authentication flow. The DeviceSigninComplete event triggers the user authentication (achieved by step 1)

Calling the CRM Web Services

  1. If no cached token available, authenticate as shown above, and cache the returned token.
  2. Instantiate either the DiscoveryServiceProxy or the OrganizationServiceProxy object as needed.
  3. Set the SecurityTokenReponse property on the proxy object to the cached token.
  4. Attach to the corresponding completion event for the method to be called. For example, use CreateCompleted for the Create method, ExecuteCompleted for the Execute method.
  5. Call the web service method on the DiscoveryServiceProxy or OrganizationServiceProxy objects.
Categories: CRM Mobile Tags: ,

Microsoft Office / Word 2013 – blog post

November 10, 2012 Leave a comment

This post has been updated directly from my Microsoft Word 2013; very cool stuff. This post is first of a series of new posts to come about entrepreneurship, CRM, marketing, sales, projects delivery, human resources and golf stuff. Hope you’ll like. Channels to leverage are blog post, twitter, LinkedIn, Viadeo, Facebook, YouTube; Email should not be forgotten.

Using Formulae in Dialogs: Example Lead Scoring

February 7, 2011 Leave a comment

When using Microsoft Dynamics CRM have you ever wondered how to create and use formulae in Dialogs? Yes this is possible using two features supported in Dialog Processes: Variables and Assign Value step. If you look at the Dialog designer page, you will see a section for creating Variables as shown in figure below.


You can add Variables with default values using this step. The Variables can be later used to create formulae in your Dialog. Three types of Variables are supported by Dialog: Single Line of Text, Whole Numbers and Floating point Numbers. Once you click on Add you will get a Dialog for defining the variable as shown in below figure.


Once the Variable is defined it appears as below figure on the designer.


You can Edit or Delete the Variables after it is defined. You can modify the name and default value of the Variables. However you cannot modify the data type of the Variables once defined. This limitation is to avoid data type mismatch errors. Suppose if some variable is defined as floating point number and used to create formulae in Dialog Process and later the variable’s data type is changed to Text then the steps using the Variables for multiplication or addition would become invalid.

Now once your Variables are defined, you can use them to create a formula using Assign Value step which is available in Add Step menu on designer.


Once you click the menu option you will see Assign Value step on the designer where you can fill the name of this step. You can use Set Properties button to create the formula. The step looks like below figure on designer.


Once you click the Set Properties button a formula definition Dialog will appear. The Variables defined in the Dialog will automatically appear in the Name dropdown.


Assign Value step supports different kind of Operators for all data types supported. For example; following table illustrate the operators supported for different data types.

Data Type Operators
Single Line of Text Set to, Append with and Clear
Whole Number Set to, Increment by, Decrement by, Multiply by and Clear
Floating point Number Set to, Increment by, Decrement by, Multiply by and Clear

Let us now develop a Dialog for Lead Qualification. Suppose your company is running some marketing campaign through phone call. Assumption is that the phone call records already exist with Regarding field as Lead and Recipient also as Lead to whom call has to be made. The marketing executive is running Dialog to achieve the objective. For this we need to author a Dialog. We will create a Dialog for Phone Call entity so that while making an outbound call, the Marketing executive directly launch the Dialog from Phone call page and start the Dialog for conversing at phone with the probable Opportunity. In order to simplify the example we will assume that the customer will be asked 2-3 questions in order to qualify the lead as Opportunity or lost Lead. First we have to plan the Dialog. For simplicity, we have very limited set of questions to qualify the Lead as shown in below flowchart.


Step 1 of this flowchart can be implemented with Assign Value step where the name variable is Set To regarding Lead’s First name data slug which is illustrated in one of the above figures. The variable initialized with First Name can be used in a Prompt greeting customer as shown below.


Now you have to check if the customer is further interested in continuing the talk. If yes then we will increment the value of current_score by 5 as per flow chart shown above and continue with other steps as per flow chart in the if-then block. To increment the value of current_score by 5 we would do following.

First select the variable ‘current_score’ from name dropdown, ‘Operator’ as ‘Increment By’ , then type ’5.0’ in the ‘Default value’ text box and finally click Ok on the Form Assistant.


In case user is not interested then we would deduct the 10 points from the current score as shown below.


Now you get how to create formulae in your Dialog. The final Dialog will look something like shown in below figure.


In above Dialog, you will notice that you can change the status of Regarding(Lead) to Qualified however the Process (Dialog or Workflow both) does not provide option to convert this Lead to Opportunity or Account. That can be achieved by placing two Create Record steps, one to create Account with the Lead’s company’s name and other to create an Opportunity with the same topic as that of the Lead as shown in following figures.


Create Account step would be configured as shown in below figure and the same account can be used as potential customer for the Opportunity created due to Lead qualification.


Obviously the Created Opportunity should have same topic and customer created in previous steps which is simple as shown in next figure which you get on clicking Set Properties button of Create Record step.


Finally test the Dialog after activating it to verify that if the Lead is qualified the corresponding Account and Opportunity are created.


Ramesh Pandey

Custom Charting Capabilities in Microsoft Dynamics CRM 2011

February 4, 2011 2 comments

Microsoft Dynamics CRM 2011 comes with in-built visual analytics. You can create charts to view aggregations of your CRM data over various dimensions, providing nice visual and interactive tools to analyze data. But, there is more to it.

It also provides you with some space alongside the records-grid. While this space is generally used for the built-in charts, it can potentially be used for well, anything. CRM 2011 also goes a long way in defining an extensibility story – a way to deploy your own custom pages on the server. Yes, you’ve got it right – I am referring to web resources. Would it not be great if you could get your web resource to show up alongside the grid? Well, that is precisely what we let you do.

Create your own custom chart

Let us start by creating a simple “Hello World” page, and making it show up alongside the Accounts grid.

1. Open your favorite text-editor, and type in the following HTML:



    <title>Hello World Page</title>



  <div style="height:49%" ></div>

  <div style="text-align:center">

  <b>A 'Hello World' web resource for the Accounts grid</b>




This is an elementary HTML page that shows a line of bold text centered horizontally as well as vertically.

2. Create an HTML Web Resource on CRM Server by uploading the above page. In case you are not familiar with web resources, you will need to do the following:

a. Navigate to Settings Customizations. Click on Customize the System to open up the Default Solution.

b. Click on New → Web Resource on the grid tool-bar to launch the Web Resource form.

c. Upload the file created in (1) above. Give the web resource a name, say new_helloWorld.

d. Click Save.


3. Now we will create a custom chart that uses this web resource. We can do so easily by using the Import Chart feature:

a. Navigate to Accounts grid and open the chart pane.

b. Click on Import Chart in the Charts tab of the ribbon.


Here’s the XML we want to import:



  <name>Hello World</name>



Note that the XML definition above contains a reference to the web resource created in (2).

Once the chart is successfully imported, we will see the following:


That was pretty easy, wasn’t it? But that was not a very useful chart though. Let us move on to something better.

Multiple charts sharing the same web resource

Consider a hypothetical problem. Let us say, I have accounts spread across different countries in the world and I would like to see their locations on a map beside the accounts grid. I would not want one map cluttered with all the accounts – rather I would want to focus on one country/region at a time, and see accounts located in only that country. To solve this problem, I would want to create different charts – each centering the map on a particular country (with a zoom factor according to the size of the country) and displaying only accounts from that country.

It would be possible to create multiple web resources addressing different map regions – however, that is not a very scalable solution. Creation of a web resource is generally a system customizer’s job – we would not want a system-customization for every new country/region that we would want to include.

Instead, what we will do is create a single ‘parameterized’ web resource. The web resource will contain the general logic for plotting accounts on a map – however, this logic would be driven by certain parameters which would be provided at runtime by the chart that is being rendered.

How does a web resource know which chart is being rendered?

If you have worked with web resources placed on forms/dashboards, you would be aware of the data query-string parameter. This parameter essentially lets the same web resource render differently in different contexts – you specify the value of this parameter (if required) at the time of adding the web resource to a particular form/dashboard.

For web resources rendering as charts, we do not let you explicitly specify a value for this parameter. Instead this parameter is always set to (a URL-encoded form of) the following format:

visid=<Visualization ID>&vistype=<Visualization Type>&viewid=<View ID>&viewtype=<View Type>

Therefore, we can get the ID and type of the chart being rendered by parsing the data query-string parameter.

Data and Presentation Descriptions of the Chart

Both System and User Charts have the following two fields.

  • DataDescription: This defines the data that is to be shown in the chart.
  • PresentationDescription: This defines the presentation and formatting of the chart.

For charts that use the in-built charting capabilities of CRM 2011, the values of the above fields have well-defined syntax and semantics. For our custom set of charts, we will continue using these fields to represent the data and presentation properties of the chart – however, we will define our own syntax and semantics for these fields based on our needs.

  • DataDescription: The country/region whose accounts are to be shown on the map.
  • PresentationDescription: This will need to convey two things: the coordinates of the center of the map, and the zoom factor. Let this be a comma-separated list of three numbers – a latitude, a longitude, and a zoom factor.

So here’s the basic idea – the web resource first figures out which chart is being rendered, then it reads the data and presentation descriptions of that chart, and parses them appropriately to extract the parameters that it needs to render the map at runtime.

Going into more detail, we will be doing the following in sequence.

  • Parse the query-string to extract the value of the data parameter. Parse this value again to obtain the ID and type of the visualization being rendered.
  • Retrieve DataDescription and PresentationDescription fields of the visualization using CRM oData end-point.
  • Parse the PresentationDescription to obtain the values of latitude, longitude and zoom-factor. Use Bing Map APIs to load a map with these values.
  • Get the country/region specified in DataDescription. Retrieve all Accounts from this country/region by making a GET request to a CRM oData URI with appropriate filters.
  • Geocode each of the retrieved account locations using Bing Map APIs, and plot them on the map.

Here’s one way you may write the web resource.



    <title>Accounts on Bing Maps</title>

    <script type="text/javascript" src=""></script>

    <script type="text/javascript" src=""></script>

    <script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>


    <script type="text/javascript">

        var map;


        // Function to construct key-value pairs from a query string.

        function getParametersFromQuery(query) {

            var parametersDictionary = new Array();

            var parameters = query.split('&');

            for (var i = 0; i < parameters.length; i++) {

                var keyAndValue = parameters[i].split('=');

                parametersDictionary[unescape(keyAndValue[0])] = unescape(keyAndValue[1]);


            return parametersDictionary;



        // Function that makes a GET request to the CRM REST end-point, and invokes a callback with the results.

        function retrieveFromCrmRestApi(url, callback) {


                type: "GET",

                url: GetGlobalContext().getServerUrl() + "/XRMServices/2011/OrganizationData.svc" + url,

                contentType: "application/json; charset=utf-8",

                dataType: "json",

                success: function (data) {






        // Function that retrieves the corresponding CRM chart, and invokes the callback when successful.

        function loadChartFromCrm(callback) {

            var parameters = getParametersFromQuery(;

            parameters = getParametersFromQuery(parameters["data"]);


            var id = parameters["visid"].substr(1, 36);

            var type = parameters["vistype"];

            var url = (type == "1111" ? "/SavedQueryVisualizationSet" : "/UserQueryVisualizationSet")

                + "(guid'" + id + "')?$select=DataDescription,PresentationDescription";

            retrieveFromCrmRestApi(url, callback);



        var locations = new Array();

        function plotAccountLocations(accounts) {

            if (accounts.length > 0) {

                var account = accounts.pop();

                var address = account.Address1_City + ', ' + account.Address1_Country;

                map.Find(null, address, null, null, 0, 1, false, false, false, false,

                    function (shapeLayer, results, places, moreResults, error) {

                        if (null != places && places.length > 0) {

                            var place = places[0];

                            var newShape = new VEShape(VEShapeType.Pushpin, place.LatLong);





                        // When we have found (or not found) the current account,

                        // recursively call the same function to find the next one.




            else {

                var shapeLayer = new VEShapeLayer();






        function loadAccountsFromCrm(dataDescription) {

            var url = "/AccountSet?$select=Address1_Country,Address1_City,Name";

            if (null != dataDescription) {

                // Filter accounts based on country specified in data description.

                url += "&$filter=Address1_Country eq '" + dataDescription + "'";



                function (data) {

                    var results = data["results"];

                    var accounts = new Array();

                    for (resultKey in results) {



                    // Once accounts are retrieved from CRM Server, plot their locations on map.






        function getMap(presentationDescription) {

            // Set center and zoom defaults.

            var center = null;

            var zoom = 4;

            if (null != presentationDescription) {

                // Calculate map-center and zoom from the presentation description.

                var arguments = presentationDescription.split(',');

                if (arguments.length > 1) {

                    center = new VELatLong(arguments[0], arguments[1]);


                if (arguments.length > 2) {

                    zoom = arguments[2];



            map = new VEMap("map");

            map.LoadMap(center, zoom, VEMapStyle.Road, true, VEMapMode.Mode2D, false, 0);

            window.onresize = function (event) { map.Resize(document.body.clientWidth, document.body.clientHeight); };




        function loadMap() {

            // First, get the chart object from CRM Server.


                function (chart) {

                    // Once we have retrieved the chart, format the map based on the chart's presentation description.


                    // Get Accounts from CRM Server based on the chart's data description, and plot them on the map.







<body onload="loadMap()">

    <div id="map"></div>



The code-snippet above uses a bunch of asynchronous callbacks – however, the basic sequence of invocation of functions is the following.

  • loadMap: Handler for the body.onload event.
  • loadChartFromCrm: Retrieve DataDescription and PresentationDescription of the current chart from the CRM 2011 oData end-point. Note the double-call to a function that parses a query-string.

var parameters = getParametersFromQuery(; parameters = getParametersFromQuery(parameters[“data”]);

[The value of the “data” parameter is essentially a query-string within a query-string.]

  • getMap: Use Bing Map APIs to load a map with the center and zoom-factor specified in presentation-description.
  • loadAccountsFromCrm: Retrieve account records from CRM 2011 oData end-point, filtered by the country specified in data-description.
  • plotAccountLocations: Add push-pins on the map to represent each of the account records retrieved above.

Now let us go ahead and create a web resource on CRM Server with the above HTML. Let us call it new_accountsOnMap. It would now be pretty simple to create various charts using it. Let us start with Accounts in the U.S.

Import the following chart Xml:



  <name>Account Locations in U.S.</name>





This is what you will see:



Similarly, the following chart Xml gives you Accounts in India.



  <name>Account Locations in India</name>






Essentially, you have created your own parallel charting infrastructure for CRM 2011 that others can use to create system or user charts as appropriate. Like any other chart, such charts will automatically show up in the chart selector beside the records grid. And yes, they can also be placed on dashboards if so desired.

I have made available for you a Microsoft Dynamics CRM 2011 Managed solution containing the web resource and two system charts based on it.


Arko Nasipuri

Microsoft Dynamics CRM 2011 Fiscal Settings and Goal Management

January 19, 2011 Leave a comment

Microsoft Dynamics CRM 4.0 had the capability of defining the fiscal setting for an organization but there was a limitation that this could only be defined once and cannot be modified thereafter. Primarily the fiscal settings were used in CRM 4.0 to set salesperson quotas. In Microsoft Dynamics CRM 2011 the fiscal settings feature is revamped and it now provides user the capability of modifying fiscal settings multiple times. With deprecation of the Quotas in CRM 2011 Goal Management is one of the primary consumers for fiscal settings. This blog post explains how the fiscal periods for the organization can be set and how it interacts with the goal management.

How to configure the fiscal settings for organization

Fiscal settings can be configured by navigating to Settings-> Business Management -> Fiscal Year Settings. The following dialogue provides the options for setting values for fiscal start date, fiscal period type and various display formats. Note that as opposed to CRM 4.0 where the fiscal settings were absent in an organization until set, CRM 2011 defaults fiscal period to quarterly starting January 1. Also the various input options for the fiscal settings are now context dependent which prevents user from entering conflicting values.


Fig: CRM 2011 Fiscal setting dialogue with defaulted values 

Following are the various fields required for organization fiscal settings:

  • Start Date: When the fiscal year is going to start from. This date typically would mark the start of the financial year in sales organization. 
  • Fiscal Period Template: What is the fiscal period type? Possible options are Annually, Semiannually, Quarterly, Monthly, 4- Week period. Once the start date and period type is defined the system can calculate the start and end dates of fiscal periods for various fiscal years.

Fiscal Display options help user to define the display format for various fiscal settings. For example consider the following monthly fiscal settings with Start Date as April 10. Note that we have selected the “Name Based on” value to “End Date” and “Fiscal Period” drop down has the options specific toMonthly fiscal period template.


Fig: Fiscal dialogue having Monthly fiscal period starting 10th April.

Goals and Fiscal settings

Fiscal periods are tied closely to goal management. Sales people usually have the quarterly sales targets, Customer service representatives need to achieve their goals for the case resolutions and so on. When the new Goal form is launched, Goal is defaulted to the current fiscal period automatically. Because for current fiscal period there are fixed start and end dates, the goal start and end dates are also displayed in read only mode.

For example if we have the monthly fiscal settings are per the fig above and user clicks new goal form, following fiscal values are defaulted on goal form (on 31 Dec 2010)


Fig: New goal form defaulting dates to current fiscal period.

FiscalPeriod: December (Based on fiscal period display value “Month Name”)

FiscalYear: FY2011(Based on Prefix:FY, YearFormat:YYYY, NameBasedOn:EndDate(on 31 Dec 2010))

From (Goal Start Date): 12/10/2010 (Based on 4/10/2010 fiscal start date)

To (Goal End Date): 1/9/2010 (Based on Goal Start Date above and monthly fiscal period type)

Updating Fiscal settings for organization

Fiscal settings in MSCRM 2011 can be updated multiple times by using the same fiscal dialogue shown above and hence provides the supports for scenarios arising from mergers/acquisitions , partnership changes, financial restructuring etc. There can be goals existing in the CRM system which are already using the old fiscal settings. To better handle situations arising from fiscal changes which can lead to data inconsistency, MSCRM goal management offers the notification and realignment mechanism. For following examples consider the goal created with fiscal settings for the current (default) fiscal period. FiscalPeriod: December, FiscalYear: FY2011, From (Goal Start Date): 12/10/2010, To (Goal End Date): 1/9/2010.

Case 1: Fiscal period template remains same but the start dates changes:

CRM system administrator moves the fiscal start date ahead by 5 days i.e. from 4/10/2010 to 4/15/2010. In this case the fiscal period template remains the same but the start date has changed. Data in the goal record still retains the old values for all fiscal and date fields. When this goal record is opened the following warning message is displayed on the goal form to notify the fiscal settings change and provides user the option to realign.

Message: “The fiscal settings of your organization have changed since the time this goal was changed. You might want to realign to the new fiscal settings. ”


Fig: Fiscal change warning when the fiscal start date is changed.

Note that the “Align with Fiscal Period” ribbon button is now enabled for this goal record. Clicking this updates the new start and end dates for the goal which is now according to the current (new) fiscal settings. Realignment is optional for the goal manager based on the business need. Note that even after realignment goal fiscal period and year still remain same as there is only the change in the date. Also the warning message is now gone.


Fig: Goal form after the realigning the fiscal period.

Case 2: Fiscal period template changes:

CRM system administrator changes the fiscal period type from monthly to quarterly (3 months). In this case also the existing data is retained as is and there is a warning message on the goal.

Message: “The fiscal settings of your organization have changed since the time this goal was changed. You might want to realign to the new fiscal settings. ”


The goal manager on seeing this warning can either choose to switch to the new quarterly fiscal settings by changing the fiscal period to quarterly as shown in the above figure. Else he can convert this goal into the custom period goal by clicking on the “Goal Period Type” radio button and can retain the goal start and end date and also get rid of the fiscal change warning.

Fiscal settings upgrade

If the fiscal settings are configured for an organization in CRM 4.0 these are retained in CRM 2011 as is, otherwise the fiscal settings are defaulted to quarterly with January 1 as the start date. Additionally the existing CRM 4.0 quotas are also upgraded to CRM 2011 but the new quotas cannot be created as these are deprecated in favor of goal management.


Hemant Gaur