Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

SDK REST - Query - join

Posted on by Microsoft Employee

Hi everybody,

I need some help on a query in SDK REST in Odata.

In the CRM,

A customer have some sales orders, and this sales orders avec some sales order details.

I added a field on the salesorderentity called : "last_variant"

And I need to find for a customer the max "last_variant" for all this salesorders.

How can I do that ?

*This post is locked for comments

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: SDK REST - Query - join

    Hi

    You can use fetch xml

    <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' aggregate='true'>

       <entity name='account'>

    <attribute name='name' />

    <link-entity name='salesorder' from='parentcustomid' to='accountid' visible='false' link-type='outer' alias='a_6c61a84be522e31194080050569c4325'>

            <attribute name='yourcolumnname' aggregate='max' />

         </link-entity>

    </entity>

      </fetch>

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SDK REST - Query - join

    deleted

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SDK REST - Query - join

    I think you should use fetchxml as there is no aggregate functions in odata.

    Refer this:

    crmbusiness.wordpress.com/.../crm-2013-when-using-fetchxml-is-better-than-odata

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans