Sort sales pipeline by label

2021-02-04

If you use the sales pipeline chart in combination with an option set for your visualization, by default the chart is ordered by the option set value. But what if you want to order by the labels of the option set instead?

Let’s take the following option set as an example:

Label Value
1 Start 274000001
2 Examine 274000003
3 Continue 274000002
4 Finish 274000004

The result would be:

Sales pipeline wrong order Sales pipeline ordered by values

Fortunately, this is quite easy to correct:

  1. Create a new unmanaged solution and add the sales pipeline chart;
  2. Export the solution;
  3. Extract the zip package;
  4. Modify the customizations.xml;
  5. Package the files;
  6. Import the unmanaged solution.

Step #4 is the key here: a small modification to the customizations.xml is necessary. The relevant part of the XML is the following:

<fetch mapping="logical" count="10" aggregate="true">
	<entity name="opportunity">
		<attribute name="opportunityrevenue" aggregate="sum" alias="sum_estimatedvalue" />
		<attribute name="my_option_set" groupby="true" alias="stepname" />
		<order alias="stepname" ascending="true" />
	</entity>
</fetch>

Remove the count attribute from the fetch tag, and the entire order tag. The modified XML now looks like this snippet:

<fetch mapping="logical" aggregate="true">
	<entity name="opportunity">
		<attribute name="opportunityrevenue" aggregate="sum" alias="sum_estimatedvalue" />
		<attribute name="my_option_set" groupby="true" alias="stepname" />
	</entity>
</fetch>

After re-importing the solution, your chart should now correctly order by label:

Sales pipeline ordered by label Sales pipeline ordered by label
Visualization

How to use filter array data operation