just wanted to ask if there's a possibility to either create a DataSet or merge, respectively push, new records?
I want to display the dataset and additional records from a webapi response. To do this I would have to merge the templates into the custom entity dataset but don't really know how as I cannot create a DataSet from scratch nor push new items.
I'm using react and input components to render lookups, datetime fields etc. and they're using the dataset properties. Is there a possibility to add new items to an existing DataSet? Or how would you approach this problem?
let items: ComponentFramework.PropertyHelper.DataSetApi.EntityRecord = this.props.checklist.sortedRecordIds.map(rec => this.props.checklist.records[rec]);
Because of EntityRecord functions I'm unable to push new EntityRecords too.
Thanks in advance!
Hi @tvd_nzi ,
The dataset is read-only. To make update/merge to your dataset-data you need to implement the webAPI requests by yourself. That's possible for now only in model-driven PCFs. You can refresh the dataset afterwards using dataset.refresh(). This will trigger an updateView again, where the dataset is containing the new data.
It depends what kind of additional records to the dataset you need, but sometimes is good to consider that you can have two or more datasets in the PCF (all datasets are read-only).
Hope this helps!
There are a couple effective answers to this.
Thanks for your feedback. I'm sorry I wasn't really specific about the use case.
In short the pcf needs to display these record sets as an aggregate
- dataset of checklists (bound custom entity)
- RetrieveMultipleResponse of template checklists (retrieved template checklist)
As soon the template checklists were retrieved I need to merge these two record sets into one.
The dataset grid is actually a DetailsList. I'll go with your second suggestion and tweak it to avoid having to rewrite the crm input react components. These components use the dataset, column etc. interfaces.
I'll be happy to share my solution and welcome any further ideas.
I ended up writing a wrapper class for the WebApi.EntityRecord interface and a module that creates a List of EntityLocalRecords (wrapper class) which contains the dataset records and the web api results.
Learn how to create your own user groups today!
Explore the latest tools,training sessions,technical expertise, networking and more.
Check out the new Power Platform Community Connections gallery!
Congratulations, the new Super User Season 2 for 2021 has started!
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.