locked
How to display Opportunity-Count on Account view RRS feed

  • Question

  • Hi,

    In the CRM 2011 SDK, I found the way to 'WorkWithViews', where we can add a custom view with a .Net program. So I tried to create a view that uses the following FetchXML to display the aggregate field for OpportunityCount in the Account entity view: -

    <fetch mapping='logical' aggregate='true'>
      <entity name='account'>
        <attribute name='name' alias='Account' groupby='true' />
        <link-entity name='opportunity' alias='Oppty' from='customerid' to='accountid' link-type='outer'>
          <attribute name='name' alias='OpptyCount' aggregate='countcolumn' />
        </link-entity>
      </entity>
    </fetch>

    The FetchXML works fine in the FetchXML-Query-Designer, but when used in the .Net program, gives error on the layoutXml of SavedQuery.

    If anyone has achieved this, kindly share the .Net code part that builds the layoutXml and fetchXml for the SavedQuery

    Thanks in advance :-)
    \Ajay


    \Ajay

    Sunday, May 20, 2012 5:23 PM

Answers

  • Though we can add custom views programmatically views do not support including fetch xml with aggregate functions included. Layout xml part of the savedquery deals with the view column layout in which the results of the fetchxml be displayed.

    You can retrieve one of the existing saved queries using retrieve multiple message and read and design a similar layout xml for your view.

    HTH 

    Sam 


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by Sam - Inogic Monday, May 21, 2012 1:20 AM
    • Marked as answer by ajayubbott Monday, May 21, 2012 3:30 AM
    Monday, May 21, 2012 1:20 AM