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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF Control Grid Setti...
Power Apps
Answered

PCF Control Grid Setting selected row to use Command Bar Context

(0) ShareShare
ReportReport
Posted on by 41

Have a PCF grid that replaces native main view. I need to mimic the OnRowSelect event handler of the native grid to set the SelectedRow so that the command bar will recognize that there is a record selected. In this case - mainly trying to get the Email a Link to work which needs to see a row is selected. Anyone have any luck with this?

I looked at articles like this (https://community.dynamics.com/forums/thread/details/?threadid=fb6c85ea-10b3-4a87-92ed-e9135aaaa8c5) but not seeing a way on the main view to set the Selected Row. 

Thanks!

I have the same question (0)
  • Verified answer
    cchannon Profile Picture
    4,702 Moderator on at

    It's easier than you think. Just use: 

     

    this.context.parameters.<your dataset name>.setSelectedRecordIds(ids)

     

    where "ids" is a string[] of the selected row guids

  • shadowfox Profile Picture
    41 on at

    Thank you so much. That works in terms of setting it - but not changing the command bar context as I would have expected.... Still unable to click Email a Link as says no records selected. Any thoughts? Thanks. 

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @shadowfox , 

     

    The solution from @cchannon  should work, as long your dataset is the first one in your manifest.

    For the second it wouldn't work.

     

    By calling this, the updateView will be called for you again.

    Maybe you could log the context.parameters.yourDataset.getSelectedRecordIds() in updateView, to check of the setting is working.
    Also, maybe you can check that your command is enabled by using another dataset control (maybe using the "show As" and switch to the standard Power Apps Grid )

  • shadowfox Profile Picture
    41 on at

    Thanks everyone - that did work, we found out that the issue and it was a silly problem. Once we figured that out - all was good! 

  • shadowfox Profile Picture
    41 on at

    Follow-up question: I see that Microsoft changes datasets where before you use to get back total number of records using dataSet.paging.totalResultCount. And I was able to process quite a bit of data. Now though if it's over 10,000 records, you get a -1 for totalResultCount and the paging to load next page is incredibility slow. 

    Anyone come across this and/or have a solution? Thanks!

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard