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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to retrieve the Selected Record Ids of a Sub Grid in CRM 2011 using javascript

(0) ShareShare
ReportReport
Posted on by 140

I've a subgrid named TimeTickets, I try: var gridControl = document.getElementById('TimeTickets_d').control var ids = gridControl.get_allRecordIds(); here I've an error :Object doesn't support property or method 'get_allRecordIds'

*This post is locked for comments

I have the same question (0)
  • AndrewCampey Profile Picture
    on at

    As the error states the method get_allRecordIds is not supported for that particular control.

    I'd suggest you use this instead

    Xrm.Page.ui.controls.get('TimeTickets')._control.get_innerControl().get_allRecordIds()

  • Paul Talbot Profile Picture
    on at

    This does not work in CRM 2013. I am desperate for a solution to our broken code.

  • Suggested answer
    Hosk Profile Picture
    on at

    this blog has some Javascript code for subgrids in CRM 2013

    vikramxrm.blogspot.co.uk/.../read-subgrid-records-ms-crm-2013-using.html

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    Hi,

    Although you can get the selected items using unsupported javascript methods, you might consider using a neat 'trick' as a more supported solution. You use an 'EnableRule' on a subgrid button that is passed the SelectedControlSelectedItemIds parameter. This function is then called everytime a record is selected/deselected and you can store the results in a variable that can be used else where in your javascript.

    This trick was originally thought up by James Wood - woodsworkblog.wordpress.com/.../crm-2013-adding-an-on-change-event-to-a-sub-grid

    Hope this helps,

    Scott

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans