Hello,
I created a PCF that includes a Details List. When the items are selected and on click of the button found on the custom page, I want the records to be retrieved in the custom page and created a record of them in another table.
this is the popup that includes the pcf dataset and the button which is added from the custom page components.
My aim is to retrieve the records selected on my custom page when the button is clicked.
I will be attaching the index.ts and components.tsx in this Post.
Thank you!
Hi @Mhmdbaba ,
I think it should work now. I had a look at my repository. I set also the DetailsList selectionMode={SelectionMode.multiple}.
I also wrap the DetailsList in a
<MarqueeSelection selection={selection}>
<DetailsList //goes here
/>
</MarqueeSelection
Not sure if that makes a difference.
What exactly doesn't work with setRecordIds?
Hi @DianaBirkelbach,
I managed to use the dataset in my code and make use of it, but I am facing a problem in setRecordIds for the dataset.
I will attach my code here. I hope you would reply.
Thank you!
Hello @DianaBirkelbach ,
Thank you for your time in reviewing my code and helping me. I will be trying this approach and update you when done.
Thank you!
Hi @Mhmdbaba ,
From the code, I see that you have a dataset PCF, but you actually don't use the data provided by the dataset.
Basically you make a webAPI request by yourself to get the records. That way it's hard to interact with the CustomPage.
You could declare another output property in your manifest, and pass that value in yout getOutputs() method, containing the selcted id. Then you can access that output property fromn your Button. But I wouldn't recommend it.
A better approach would be to let the platform work for you.
1. make use of the dataset property you've declared inside your manifest. This will contain the data provided by your CustomPage. The definition of the data will be made using PowerFx (get a dataSource in your CustomPage and filter the data as needed using PowerFx)
2. inside your component you can use the dataset.records provided, to show the data.
3. The dataset has a method to set the selectedRecordIds: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/dataset?WT.mc_id=BA-MVP-5004107#methods. If you set that inside your PCF, you are able to access the selectedRecord outside the PCF (in your CustomPage)
4. In the CustomPage, define the OnSelect function for your button. Set oit as <YourPCF>.Selected like in the screenshot below (of course, through the ".Selected " you have access to the fields inside the collection).
Actually there is a FluentUI dataset PCF, ready to use, made by the Microsoft Power CAT team. You can find it in the Creator Kit: https://powerapps.microsoft.com/en-us/blog/introducing-the-creator-kit-efficiently-create-performant-fluent-ui-based-power-apps/. There are 3 solutions: one with the PCFs (not only the FluentUI DetailsList, but a lot of others), and demo solutions (one of them fpr CustomPages - in the MDA solution).
PS: By the way, using the Xrm object inside the PCF is not supported. If you need webAPI Requests, you must declare the usage inside the manifest, and get yout webAPI object through context.webAPI: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/context?WT.mc_id=BA-MVP-5004107#webapi
Hope this helps 🙂
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
76
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1