Hi,
I have a requirement to copy selected columns on a Dataverse record (custom table) into a new record. There are a series of child records which should also be copied across and associated to the record. I'd like to approach this by creating a 'Clone' button using the new command bar editor to avoid installing a smart button solution, however I'm encountering some difficulties passing the 'Parent' cloned record to the Child Records.
I found this blog which offers helpful advice on doing exactly this requirement: Clone records with Power Fx & custom command bar button - Jukka Niiranen, and provides the following code:
Set(ClonedProduct, Patch(Products, Defaults(Products),{Name: "Copy of " & Self.Selected.Item.Name, 'Product Category': Self.Selected.Item.'Product Category', Vendor: Self.Selected.Item.Vendor, Description: Self.Selected.Item.Description})); ForAll(Self.Selected.Item.Assets, Patch(Assets, Defaults(Assets),{Name: "Copy of " & Name, Vendor:ClonedProduct.Vendor, Product:ClonedProduct, 'Purchase Date':Today(), 'Purchased From':'Purchased From', 'Purchase Cost':'Purchase Cost', 'Warranty End Date':'Warranty End Date', Description:Description})); Notify("Product " & Self.Selected.Item.Name & " and its assets have been cloned. Please open the records and update the necessary fields.")
However, the Set() element no longer appears to be supported, and neither is UpdateContext, or Collect or Clear Collect, any ideas on how I could get this to work?
Solved! Go to Solution.
If anyone stumbles across this in the future, I managed to resolve the above issue by using the With() function
If anyone stumbles across this in the future, I managed to resolve the above issue by using the With() function
User | Count |
---|---|
252 | |
101 | |
94 | |
47 | |
38 |