Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Get Grid Data using Javascript API and Custom Command Button

(0) ShareShare
ReportReport
Posted on by 184

Hello,

 

I'm trying to pull data from a sub grid using JavaScript API and a custom command on the form header. I was able to do so before with a different grid when I added the custom command button to the sub grid header, so it displays within the sub grid, and call the function getgrid().getrows().

 

The sub grid I'm working with is the segment members grid within the marketing app. 
I created a custom command on the main form header and passed the PrimaryControl parameter. I believe I found the name of the control and did the following:

var formContext = PrimaryControl;
var test = formContext.getControl(/MembersControl/);

This returns info about the control, but I cant see any of the record data nor access and rows. getGrid().getRows() does not work. 
 

The two main differences between this feature and the last one I worked on is that by button is on the main form header while last time I had it within the sub grid, and I believe this is a custom control rather than a conventional sub grid added to the form. I tried to find the view within the entity on the back end but couldnt find it. 

After not having much success, I called getcontroltype() and it returned the following: customcontrol:MscrmControls.SegmentMembersHubControl.SegmentMembersHubControl

Can this not be done since it may be a custom control? Am I missing an extra step somewhere in order to retrieve the data?

Any help would be greatly appreciated!! Thank you. 

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans