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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

order by column of linkentity

(0) ShareShare
ReportReport
Posted on by 80

codes same like following:

var exp = new QueryExpression("table1"){

columnSet=...,

LinkEntities={

new LinkEntity("table1", "table2", "key1", "key2", oinOperator.Inner){

EntityAlias = "t",

Columns = ...

}

},

Orders = {

new OrderExpression("t.sortColumn", ...)

}

}

error message: "table1" entity doesn't contain attribute with Name='t.sortColumn'. 

but the column is exists.

I wonder to know how to resolve it. thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    Do you have any kind of column name  "sortColumn" in table1?

    Can you please share full code.

    You can use fetchxml ,use fetchxml builder in XRMToolbox.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Steven ,

    I wrote an article for you .

    "Alias" name  in the ordering attributes does not support  in queryexpression . You should use the attributes name directly  which you are retrieving using link entity or parent entity.

    For more understating please have a look my blog --

    goutamdascrm.wordpress.com/.../understanding-queryexpression-orders-in-dynamics-365

  • Community Member Profile Picture
    on at

    Hi, you can use advanced find and compose the query. Then you can download the fetchxml code of the query.

    Use this code :

    var query = "the fetch downloaded with advanced find"

    service.RetrieveMultiple(new FetchExpression(query))

    Otherwise you can execute the query and use linq to order :

    service.RetrieveMultiple(exp).Entities.OrderBy(e=>e."aliased value name")

  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at

    Hi,

    unfortunately we cannot do sorting on link entities, not even from Advance find.

  • gdas Profile Picture
    50,091 Moderator on at

    Hi Steven,

    Ho do you go with this ? If above answer helps you , please close the thread which will helps others in future.

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans