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 / setSelectedRecordIds m...
Power Apps
Answered

setSelectedRecordIds method triggering update view everytime

(0) ShareShare
ReportReport
Posted on by 78

I having checkbox on my PCF control on click of which we are using setSelectedRecordIds to set the id of selected record to show ribbon buttons. But somehow from past one week when this method is triggered it calls the update view method which refreshes my control. 

 

In the screenshot we can see in updated properties selecteditems.

 

Anybody facing same issue ?

 

test.png
I have the same question (0)
  • Sheldon Copper Profile Picture
    200 on at

    We are facing the same issue in our project.

    On click of an element, we select the record using setSelectedRecordIds but this method triggers the updateView method and resulting in the reset of the selection of records. We also notice that this issue is occurring in some CRM regions like crm4. On CRM8 and CRM region it is working as expected.

    Some of our clients have raised this issue to us.


    @AnqiChen @HemantG could you please help us out?

    Thanks in advance.

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

    Hi @Bhuvita , Hi @sheldoncopper73 , 

     

    I can see that the updateView is called after setSelectedRecordIds, but I cannot say if that is new.

    In the context.updatedProperties I see ["SelectedItems"], and the dataset.getSelectedRecordIds() still has the selection.

    Does getSelectedRecordIds return [] to you, when updateView is called.

     

    My dataset PCF still works, but since the updateView is called often, I use React.memo around my React component and render only if the dataset or container width or height changes. I'm not sure if I'm lucky on my environment (crm4 region), or the React.memo does the job for me.

     

    Hope it helps!

     

    Kind regards,

    Diana

     

     

  • Ali .NET Profile Picture
    on at

    @Bhuvita @sheldoncopper73 

     

    As a workaround you can try setting a private property to flag that update view should not run when you are setting selected record IDs.

  • Verified answer
    aroudaki Profile Picture
    Microsoft Employee on at

    when setting selected records updateView should be called since it is changing the dataset state. 
    However, setting selected records wasn't causing updateView before which was incorrect.
    This issue been recently fixed. That's why you see the change in the behavior. 

    Based on documentation for updateView, this method will be called for any data or metadata changes and the controls should assume updateView will be called multiple times during lifecycle of the control. Best practice is to use updatedProperties and other methods on dataset to decide if the control need to react (re-render) on a call to updateView or not.

  • Bhuvita Sisodiya07 Profile Picture
    78 on at

    Hi @DianaBirkelbach 

    getselectedrecordid do return data indeed when update view is called.

    So I think what  @aroudaki @KAL suggested of using a flag on updated properties to decide whether controls needs to react or not on call of update view should work.

     

    Thanks everyone for the reply.

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard