Announcements
No record found.
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
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)
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
Hey John, thanks for the link!
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
Xrm.WebApi.retrieveMultipleRecords
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
TNJ_CRM_Team 2