Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to get grid value from javascript

Posted on by 1,558

Hello All,

I want to get grid data by java-script.How can i get it.Please suggest me.

Scenario:

I have a opportunity form and on it I have a grid "Product Line Items".

I want to get all grid items(data) in a javascript and using loop want to shown on alert.

*This post is locked for comments

  • Tin Profile Picture
    Tin 1,558 on at
    RE: How to get grid value from javascript

    Its done.....

    Thanks all for precious support.

    I had replaced the below line:

    "/XRMServices/2011/OrganizationData.svc/OpportunityProductSet?$select=*"

  • Tin Profile Picture
    Tin 1,558 on at
    RE: How to get grid value from javascript

    Thanks for reply.

    when i used your code its showing only displayed records only i need all data which is esist in opportunityproduct entity.So I am using below code.

    function GetGridVal() {

       var id = Xrm.Page.data.entity.getId();

       var req = new XMLHttpRequest();

       req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/OpportunityProductSet?$select=OpportunityId,OpportunityProductId&$filter=OpportunityId/Id eq guid'" + id + "'"), false);

       req.setRequestHeader("Accept", "application/json");

       req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

       req.onreadystatechange = function () {

           if (this.readyState === 4) {

               req.onreadystatechange = null;

               if (this.status === 200) {

                   var returned = JSON.parse(req.responseText).d;

                   var results = returned.results;

                   for (var i = 0; i < results.length; i++) {

                       var OpportunityId = results[i].OpportunityId;

                       var OpportunityProductId = results[i].OpportunityProductId;

                       alert(OpportunityProductId + "" + OpportunityId);

                   }

               }

               else {

                   alert(this.statusText);

               }

           }

       };

       req.send();

    }

    But here how i can get product name,quantity and all.....?

  • Tin Profile Picture
    Tin 1,558 on at
    RE: How to get grid value from javascript

    ohh understand u.

    I have  Microsoft Dynamics® CRM Online 2015 Update

    (7.1.0.1086) (DB 7.1.0.1082)

  • Tin Profile Picture
    Tin 1,558 on at
    RE: How to get grid value from javascript

    Hi Guido,

    Im using CRM 2015 office 365 means online.

    I want to get grid value by javascript on pageload.

    So,how i can do this.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans