Hi @marvinbarnuevo ,
Since the event after adding the record in the subgrid is triggered, you need to refresh your dataset PCF.
I've just tried it out in the console: Xrm.Page.ui.controls.get("MyDatasetPCF").refresh(), and I get the data that I've changed in another window. So this should work too.
So you need to register something like this on your form OnLoad:
function myFunction(executionContext) {
var formContext = executionContext.getFormContext(); // get the form context
var gridContext = formContext.getControl("YourSubgrid");// get the grid context
var refreshPCF = function () {
formContext.ui.controls.get("YourDatasetPCFControlName").refresh();
};
gridContext.addOnLoad(refreshPCF);
}
You could make some console.log in your PCF "updateView" method, to check that is called.
If you did exactly the same and still doesn't work, maybe there is an issue with the PlugIn. It should be sync, and since you want to preset data, should be registered on "Pre" stage. Maybe the "refresh" is executed before the PlugIn is done?
Hope one of these helps.
Kind regards,
Diana