|
19.01.2011, 21:11 | #1 |
Участник
|
Microsoft Dynamics CRM Team Blog: Custom Charting Capabilities in Microsoft Dynamics CRM 2011
Источник: http://blogs.msdn.com/b/crm/archive/...-crm-2011.aspx
============== 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: Hello World Page A 'Hello World' web resource for the Accounts grid 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. 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. Here’s the XML we want to import: account Hello World new_helloWorld 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=&vistype=&viewid=&viewtype=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.
Going into more detail, we will be doing the following in sequence.
Accounts on Bing Maps
var parameters = getParametersFromQuery(window.location.search.substring(1)); parameters = getParametersFromQuery(parameters["data"]);[The value of the “data” parameter is essentially a query-string within a query-string.]
Import the following chart Xml: account Account Locations in U.S. U.S. 39.8,-98.5,4 new_accountsOnMap Similarly, the following chart Xml gives you Accounts in India. account Account Locations in India India 21,78,4 new_accountsOnMap 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. Cheers! Arko Nasipuri Источник: http://blogs.msdn.com/b/crm/archive/...-crm-2011.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|