My mission is to copy rows from one subgrid to an other using plugin, relationship is N:1 but it used in a grid on the form. How can I do that?
My mission is to copy rows from one subgrid to an other using plugin, relationship is N:1 but it used in a grid on the form. How can I do that?
Hi,
You could write plugin on Associate message which will trigger every time when new records added to the subgrid.
Hi sahara,
You just need to retrieve (https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.iorganizationservice.retrieve?view=dynamics-general-ce-9) the records from the old grid, create a new record(s) and refresh the grid.
Please check https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.iorganizationservice.create?view=dynamics-general-ce-9 on how to create a new record using C#.
As its not possible to refresh the grid from a plugin you will need to use formcontext.data.refresh (https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data/refresh) to refresh it. An option will be to use it within a setTimeout function.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156