Question Status

Suggested Answer
MrTony asked a question on 15 Jul 2013 3:14 AM

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'

Reply
Andrew Campey responded on 16 Jul 2013 5:23 PM

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()

Reply
Paul Talbot responded on 2 Dec 2013 3:59 PM

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

Reply
Suggested Answer
Ben Hosking responded on 12 Feb 2014 2:32 AM

this blog has some Javascript code for subgrids in CRM 2013

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

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply
Suggested Answer
Scott Durow responded on 12 Feb 2014 3:30 AM

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

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply
Suggested Answer
Ben Hosking responded on 12 Feb 2014 2:32 AM

this blog has some Javascript code for subgrids in CRM 2013

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

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply
Suggested Answer
Scott Durow responded on 12 Feb 2014 3:30 AM

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

Scott Durow

Read my Blog   |  Follow Me on Twitter  |  Rockstar365

Reply