web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamic Grouping with Fetchxml

(0) ShareShare
ReportReport
Posted on by 935

Hi All

I was wondering whether it is possible use  group by in fetchxml using a parameter ie: if the user selects account then the accountname field has groupby ='true' but if they select competitor (in the linked entity) then it has the groupby = 'true' (see fetchxml below)

<fetch mapping="logical">

 <entity name="Opportunity">

   <attribute name="name" />

   <attribute name="accountidname" />

   <attribute name="statecodename" />

   <attribute name="statuscodename" />

   <attribute name="actualclosedate" />

   <attribute name="estimatedvalue" />

   <link-entity name="OpportunityCompetitors" to="opportunityid" from="opportunityid" alias="co" link-type="outer">

     <link-entity name="Competitor" to="competitorid" from="competitorid" alias="c" link-type="inner">

       <attribute name="name" />

     </link-entity>

   </link-entity>

<filter type='and'>

           <condition attribute='statecode' operator='in' value='@oppStatus'>

  <condition attribute="actualclosedate" operator="on-or-after" value="@startDate" /> <!-- need to cast the parameter to yyyy-mm-dd?-->

  <condition attribute="actualclosedate" operator="on-or-before" value="@endDate" />  

      </filter>

 </entity>

</fetch>

Is this possible to do natively (ie: groupby = '@groupby') or do I have create a webservice to include this logic?

Regards

Charles

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans