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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM how to sort records based on owner name

(0) ShareShare
ReportReport
Posted on by 6

Hello all experts ,

i need to sort the records based on owner name in an ascending order using javascript .

it will be great if someone can help me in this please.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    if  you code has list or arrays of records, you can define a function to sort, in the function you can define which prop you want to sort. As long as you use the Owner name to sort, it should work fine

    stackoverflow.com/.../sort-array-of-objects-by-string-property-value

    How you are retrieving the data, is it web api or other means? you should be able to sort in your query itself, you do not need to do this in javascript unless you have a specific requirement to do so.

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    In Java Script you have to write below code to get owner name:

    if (Xrm.Page.data.entity.attributes.get("ownerid").getValue() != null) {

              var id= Xrm.Page.data.entity.attributes.get("ownerid").getValue()[0].id;

              var name= Xrm.Page.data.entity.attributes.get("ownerid").getValue()[0].name;

              var entityType= Xrm.Page.data.entity.attributes.get("ownerid").getValue()[0].entityType;

          }

    Collect name in an array. Then follow below link to sort name:

    stackoverflow.com/.../sort-array-by-firstname-alphabetically-in-javascript

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…

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