mscrm-addons.com - Blog

News.mscrm-addons.com Blog

rss

Hello and welcome to our blog! What can we do for you? Are you looking for further technical information or step-by-step instructions to our products? Or would you like to read the latest news on mscrm-addons? Please feel free to browse our blog for detailed information and to share our posts!


How to generate custom charts in dashboards (advanced)

Content:

Part One: How to create the chart? 
Part Two: How to create the drill-down click?

 

Part One: How to create the chart?

 

Required Preparation:

Create the FetchXML. To create a custom fetch it is advisable to use a fetch generator tool. If you use DocumentsCorePack, such a tool is included. Otherwise you can use the Stunnware Tools for MSCRM.

In our tutorial we use the following Fetch (keep in mind that you have to add aliases on link-entities):


    <fetch mapping="logical" version="1.0">
          <entity name="invoicedetail">
                <attribute name="extendedamount_base">
                <attribute name="baseamount">
                <attribute name="extendedamount">
                <attribute name="productdescription">
                <attribute name="productid">
                <attribute name="tax">
                <link name="invoice" from="invoiceid" to="invoiceid" alias="invoiceid" /> 
                          <attribute name="customerid">
                          <attribute name="invoiceid">
                          <attribute name="invoicenumber">
                          <attribute name="name">
                          <attribute name="new_invoicedate">
                          <attribute name="ptm_invoicenumber_short">
                          <attribute name="totalamountlessfreight">
                          <attribute name="transactioncurrencyid">
                              <filter>
                                    <condition attribute="new_invoicedate" operator="between">
                                      <value>2009-01-01T00:00:00</value> 
                                      <value>2009-12-31T00:00:00</value> 
                                   
                         </condition> 
                                    <filter>[datecondition]</filter> 
                                 
                            </filter> 
                                 
                               
                <link name="product" from="productid" to="productid" alias="productid" /> 
                          <attribute name="name">
                          <attribute name="subjectid">
                          <filter>
                            <condition attribute="name" operator="like" value="MS CRM%">
                        </condition>
                            </filter> 
                <link name="subject" from="subjectid" to="subjectid" alias="subjectid" /> 
                            <attribute name="title">
                    [seriescondition]                                                            
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                                </attribute>
                             </entity> 
                           </fetch>

 

How to create the chart?

1. When you create custom charts you must set the data property on the general-tab to Custom.

Figure 1: Dashboard Chart - custom chart

 

2. Also, you have to go to the Values-tab and fill the values manually. Have a look at the following descriptions to get more information about the fields.

ChartTypeValues: stackedbarseries (in our example)

Value Single Series Multi Series
stackedareaseries   *
stacked100areaseries   *
stackedbarseries   *
stackedbar100series   *
stackedsplineseries   *
stackedsplineareaseries   *
stackedsplinearea100series   *
areaseries * *
barseries * *
doughnutseries *  
lineseries * *
pieseries *  
splineseries *  
splineareaseries *  
splinerangeseries *  
stickseries *  
candlestick *  
bubbleseries *  

Chartseries: 2 (in our example)

Value Description
1 Single Series Chart
2 Multiple Series Chart

DataValue: empty

EntityValue: 1091 (in our example)
This is the CRM Object Type Code of the entity. You can find a list at: http://yourCrm:yourPort/sdk/list.aspx (Example: http://crm:5555/sdk/list.aspx)

ViewValue: empty

OperationValue: sum (in our example)
Define the operation for the ValueValue field.

Value
sum
count
average

LabelValue: invoiceid.new_invoicedate (in our case)
Sets the display value for the chart labels.

LabelValueType: datetime (in our example)

Value
string
money
datetime
lookup

The values (status, state, owner, customer, lookup, picklist) were handled as the same.

GroupByValue: month (in our example)

Value
weekday
day
month
year

SeriesTypeValue: string or empty (in our example)
See at the field LabelValueType for the available values.

ValueValue: extendedamount_base (in our example)
Defines the values for the X-axis.

ValueTypeValue: money (in our example)
See at the field LabelValueType for the available values.

Seriesvalue: subjectid.title (in our example, leave it empty on single series charts)
Define the display value for the series labels.

GroupBySeriesValue: category (in our example)

Value
category
weekday
day
week
week/year
month
quarter
quarter/year
year

GroupSortingValue: 1 (in our example)

Value Description
1 Ascending(Label)
2 Descending(Label)
3 Ascending(Value)
4 Descending(Value)

charttypevalueINT: empty

GroupBySeriesSortingValue: empty (in our example)

Value Descrption
1 Ascending
2 Descending

If you fill out all of these necessary values you should be able to see the chart in your dashboard.

 

Part Two: How to create the drill-down click?

How to edit the FetchXML?

To show the correct entries in the grid view we have to add two flags in the FetchXML to filter the results.

[datecondition] 
Add this condition to the LabelValue (in our case invoiceid.new_invoicedate. The date condition must be in a  tag. It should look like: [datecondition]

[seriescondition]
Set this condition to the seriesvalue (in our case subjectid.title).

Have a look at the FetchXML above to see where I have added the conditions.

Set up the LayoutXml
With the layout-xml you define the columns in the grid that will be opened if you click on a chart graph. Find an example of the .xml that we need in our custom chart here:

layoutxml:

 
   
   
   
   
 


(in our case)

Important notes:

object="1091" – This must be the EntityValue. (For more information go to PART ONE and have a look at the EntityValue)
- This must be the root entity id attribute-name.
- For each column in the grid you have to define such item. Be sure your fetch-xml returns this attribute!

EntityShemaName: invoicedetail (in our example)
The root entity schema name from our fetchXml. 

Please note: Actually we are finished now, but for some reasons we have to set a date filter to get the drill-down click to work.

DateFilterValue: new_invoicedate (in our example)

Go to the General-tab and set up the following fields:
From: 01.01.2009 (in our example)
To: 31.12.2009 (in our example)

Now we should be able to click on a graph without an error and a grid shows us the desired data.

 

image

Figure 2 & 3: The configured Edit-Form

That’s it! We appreciate your feedback! Please share your thoughts by sending an email to support@mscrm-addons.com.




Comments are closed.