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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Answered

Get all record from view using javascript

(0) ShareShare
ReportReport
Posted on by

Hi all,

Can any one suggest, how we  get all record from view using java script.
We have view Name and view ID, but don't know how to get data from that view using javascript.

Thanks

*This post is locked for comments

  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Hi John,

     I don't think you can do it in one step - you have to get fetchxml for that view first, and, then, you need to run that fetchxml query.

     To run fetchXml, you can use this approach:

    community.dynamics.com/.../use-fetchxml-to-retrieve-data-from-ms-crm-2016-using-web-api

     And you can use the same approach to retrieve fetchXml for the view:

    - You'll be using either SavedQuery or UserQuery entity (depending on what kind of view it is)

    - Here is an example of how you can do it for UserQuery in C# - you won't need any of the authentication in JavaScript.. just look at what the attributes are, and, then, construct your fetchXml for the UserQuery entity  (SavedQuery should be very similar in that sense)

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks ALEX

    We have solved this problem in two steps.

    I have followed the below link

    debajmecrm.com/.../leverage-web-api-to-execute-your-system-views-personal-views-and-custom-fetchxml-in-dynamic-crm-2016

  • ashlega Profile Picture
    34,477 on at

    Hey John, thanks for the link!

  • Suggested answer
    JeganathanG Profile Picture
    27 on at

    Hi Arun_996 

    Retrieve data from a view in Dynamics 365 using JavaScript, you can use the Xrm.WebApi.retrieveMultipleRecords method of the Web API. You need to pass the entity name and view ID as parameters

    var entityName = "account";
    var viewId = "00000000-0000-0000-0000-000000000010";
    var fetchXml = ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    ""  
                    "";
    
    Xrm.WebApi.retrieveMultipleRecords(entityName, "?fetchXml="   encodeURIComponent(fetchXml)).then(
        function success(result) {
            console.log(result);
        },
        function (error) {
            console.log(error.message);
        }
    );
    

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
TNJ_CRM_Team Profile Picture

TNJ_CRM_Team 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans