Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Unanswered

How to retrieve top 15 total values of a field from list of opportunity records for specific month

Posted on by 35

Hi Experts,

   I have a requirement to fetch top 15 values of a field for a particular month on opportunity form .

 Is it possible to achieve using fetch xml  ? Please suggest the best approach to implement .

Appreciate if you share the fetch xml for the same ?

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How to retrieve top 15 total values of a field from list of opportunity records for specific month

    Hi partner,

    For example, I want to get the top 5 opportunity records order by "createdon" and were created in Oct 2019, here is the sample fetchxml

    <fetch top="5" version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="opportunity">
        <attribute name="name" />
        <attribute name="customerid" />
        <attribute name="estimatedvalue" />
        <attribute name="statuscode" />
        <attribute name="opportunityid" />
          <condition attribute = 'createdon' operator='between'>
            <value>2019-10-01 00:00:00</value>
            <value>2019-10-31 23:59:59</value>
          </condition>
        <order attribute="createdon" descending="true" />
      </entity>
    </fetch>

    Hope it helps.

    Best Regards,

    Leo

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans