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

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: CRM how to sort records based on owner name

    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

  • Verified answer
    Kokulan Profile Picture
    18,054 on at
    RE: CRM how to sort records based on owner name

    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.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans