Experience your
30 day trial
now!
GET STARTED
This blog demonstrates how to create a chart from data in the current entity alongside data from related entities.
Let’s take the following scenario:
A Not For Profit Organization is using CRM 2011 to track the pledges and donations made by their donors. Each pledge a donor makes has a Pledge Amount and will have 1 to * donations associated to it. Each Donation has a Cash-Value and a Status. The Status will have one of the following values: Outstanding, Processing, or Collected.
The CRM user that is responsible to manage the pledges for a given cause needs to be able to quickly see the status of a given pledge i.e. the original amount of the pledge and the amount collected. One possibility is to show the following chart in the Pledge form:
where:
We will cover how to:
To create this chart and display it in the Pledge form, do the following:
1. Go to Settings > Customizations > Customize the System.
2. Create a Pledge entity with the field ‘Pledge Amount’ and a Donation entity with the fields ‘Cash-Value’ and ‘Status’.
3. Open the Donation entity
4. Create a new bar chart
5. Create a series for the field Cash Value.
6. Open the Pledge main form
7. Add a One Column Section
8. Insert a Sub-Grid. Enter the unique Name and Label. Select the entity (Donations) and the default View. Also check the box ‘Show Chart Only’ in order to hide the sub-grid.
9. In the formatting tab, set the number of rows to 12
10. Save, Close, and Publish all the customizations
11. Open a Pledge form
12. You will see the following chart.
13. Add a Global OptionSet in order to be able to change the legends’ labels
14. Now we have to manually modify the chart.
15. Export the chart.
16. Open in your favorite XML editor or notepad
17. Replace the generated <fetch> with the following:
<fetch mapping="logical" aggregate="true">
<entity name="new_donation">
<link-entity name="new_pledge" to="new_pledgeid" from="new_pledgeid" link-type="outer">
<attribute alias="aggregate_pledgeamount" name="new_pledgeamount" aggregate="avg" />
</link-entity>
<link-entity name="new_donation" from="new_donationid" to="new_donationid" link-type="outer">
<attribute alias="aggregate_collected" name="new_cashvalue" aggregate="sum" />
<filter>
<condition attribute="statuscode" operator="eq" value="100000001" />
</filter>
<attribute groupby="true" alias="groupby_column" name="statecode" />
</entity>
</fetch>
18. Rename the aliases in <category> to match the ones above
<category>
<measurecollection>
<measure alias="aggregate_pledgeamount" />
</measurecollection>
<measure alias="aggregate_collected" />
</category>
19. Replace the generated <Series> with the following: Note the attribute ‘Name’ which is telling to use the Option value of the OptionsSet as labels for the legends.
<Series>
<Series Name="o:new_pledgestatus,100000000" ChartType="Bar" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40, DrawingStyle=Cylinder">
<SmartLabelStyle Enabled="True" />
</Series>
<Series Name="o:new_pledgestatus,100000001" ChartType="Bar" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40, DrawingStyle=Cylinder">
20. Add the <Legends> node manually at the end of the Chart node.
<Legends>
<Legend Alignment="Center" LegendStyle="Table" Docking="right" IsEquallySpacedItems="True" Font="{0}, 11px" ShadowColor="0, 0, 0, 0" ForeColor="59, 59, 59" />
</Legends>
</Chart>
21. Remove the label ‘Active’ on the Status Axis by adding the Enabled attribute.
<AxisX LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
<MajorTickMark LineColor="165, 172, 181" />
<MajorGrid LineColor="Transparent" />
<LabelStyle Enabled="false" Font="{0}, 10.5px" ForeColor="59, 59, 59" />
</AxisX>
22. Save the file and import the chart.
23. Publish all the customizations.
24. Open a Pledge entity.
Final result
Summary:
We have showed you how to manually modify CRM 2011 charts in order to:
For more information on how to further modify the CRM 2011 charts, see also the blogs
“CRM 2011 Charts – Know the Real Potential”, Part 1 and Part 2.
Christian J. Betrisey
Here is the full chart XML that we modified in this example:
<visualization>
<visualizationid>{AB00D3AF-49E9-E011-B89B-00155DA96A01}</visualizationid>
<name>Pledge Status by Amount</name>
<primaryentitytypecode>new_donation</primaryentitytypecode>
<datadescription>
<datadefinition>
<fetchcollection>
</fetchcollection>
<categorycollection>
</categorycollection>
</datadefinition>
</datadescription>
<presentationdescription>
<Chart Palette="None" PaletteCustomColors="149,189,66; 197,56,52; 55,118,193; 117,82,160; 49,171,204; 255,136,35; 168,203,104; 209,98,96; 97,142,206; 142,116,178; 93,186,215; 255,155,83">
<ChartAreas>
<ChartArea BorderColor="White" BorderDashStyle="Solid">
<AxisY LabelAutoFitMinFontSize="8" TitleForeColor="59, 59, 59" TitleFont="{0}, 10.5px" LineColor="165, 172, 181" IntervalAutoMode="VariableCount">
<MajorGrid LineColor="239, 242, 246" />
<LabelStyle Font="{0}, 10.5px" ForeColor="59, 59, 59" />
</AxisY>
</ChartArea>
</ChartAreas>
<Titles>
<Title Alignment="TopLeft" DockingOffset="-3" Font="{0}, 13px" ForeColor="59, 59, 59"></Title>
</Titles>
</presentationdescription>
<isdefault>false</isdefault>
</visualization>
Hi,
Could you provide an example of something out of the box? Is it possible to have a column chart that displays the sum of Open Leads side by side with the Sum of Open & Won Opportunities by Campaign?
Thx,
Richard