Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Retrieve all sub-grid records

Posted on by 240

Hi All,

I am trying to retrieve All sub grid records.(Custom entity name Registrations on Contact form).

var firstEntityReference = Xrm.Page.getControl("Registrations").getGrid().getRows().get(0).getData().getEntity().getEntityReference();

This is retrieving the first record in the subgrid as I mentioned 0 in getData. But my logic is retrieve all the subgrid records and if in any of the subgrid if the attribute Price is null then just show the error as there is no price

foreach(subgrid record)

{

var price=getPrice(Subgrid Guid);

if(price is null)

{ } it should break the foreach loop and and show form notification that proce is not filled for some subgrid record(s).

if(price is not null) for every subgrid record it should call another function.

}

let me know if anyone knows hoe to imåplement.

  • Manish Jain Profile Picture
    Manish Jain 50 on at
    RE: Retrieve all sub-grid records

    As per MSDN getRows returns collection of every gridRow in the grid so ideally getRows should do the job

    docs.microsoft.com/.../getrows

    Thanks

  • RE: Retrieve all sub-grid records

    Xrm.Page.getControl("Registrations").getGrid().getRows() will give you record from first page . if you need all the record you will have to make server side call using retrieveMultipleRecords

  • Suggested answer
    ajyendra Profile Picture
    ajyendra 1,730 on at
    RE: Retrieve all sub-grid records

    Hi try this

    Xrm.Page.getControl("Registrations").getGrid().getRows()

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans