locked
Order by in Fetch XML when using an Option Set for a chart RRS feed

  • Question

  • Hi

    I have a chart that displays the current leads in CRM 2013 by the leadsourcecode field.

    <fetchcollection>

     <fetch mapping="logical" aggregate="true">

              <entity name="lead">

                <attribute name="leadsourcecode" groupby="true" alias="_CRMAutoGen_groupby_column_Num_0" />

                   <link-entity name="lead" from="leadid" to="leadid" link-type="outer">

                     <attribute alias="aggregate_last30days" name="createdon" aggregate="countcolumn"></attribute>

                        <filter type="and">

                          <condition attribute="createdon" operator="last-x-days" value="30" />

                        </filter>

                      <order alias="aggregate_last30days" descending="true" />

                  </link-entity>

              </entity>

            </fetch>

          </fetchcollection>

    No matter what I do it does not Order the chart by the Values in the chart it orders them by the value assigned in the Option Set field. Now a workaround is to supposedly use a lookup of leadsourcecode and then it will order by the total leads for each leadsourcecode.

    This link describes the issue however I can't get my head around the way they are resolving it.

    I have googled and binged and can't understand how to do this. Some forums suggest it should work in CRM Online however it doesn't. Similar charts with same XML work fine just not when using an Option Set field.

    Any advice, pointers ect. what be highly appreciated!


    • Edited by antvc Monday, August 4, 2014 4:29 AM
    Monday, August 4, 2014 4:25 AM