Notifications
Announcements
No record found.
Need to know how to implement cloning functionality on a button added by Ribbon. As I will be adding subgrid on form and on clicking clone button it should copy the records on subgrid
Hi,We can add ribbon button on Subgrid as Create Clone.After this we need to create, script, action and plugin as described in below link:
https://balugajjala.wordpress.com/2017/06/01/clone-a-case-record/
The flow will be like:-> Ribbon Button-> Script-> Call Custom Action in Script -> Plugin will get trigger(i.e. Registered plugin on custom action)-> Plugin will create clone record.Thanks,Pradeep.
Please mark this as VERIFIED. If it helps
Writing code to implement cloning functionality can be a challenging tasks.
Alternatively you can look at third party apps to clone your CRM records. You can clone your records in just one click by using our Microsoft-preferred 1-click app Click2Clone.
For instance, if you want to clone an opportunity, just click on the Click2Clone button, and you will have a clone of that opportunity in no time.
This app will also assist you in creating multiple copies of a record. You can clone a single record as well as multiple records in one go by using our Microsoft-preferred app Click2Clone. Watch this video to explore how Click2Clone can help you in different ways with all your cloning requirements.
To know more about Click2Clone download a 15-day trial from our website or Microsoft AppSource or write us at crm@inogic.com.
Thanks!
Hi,
To implement the cloning functionality on a button added by Ribbon in Dynamics 365 CRM, you will need to perform the following steps:
Create a JavaScript function that will handle the cloning functionality. In this function, you will need to retrieve the selected records from the subgrid and then create new records with the same data.
Add the JavaScript function to a web resource in Dynamics 365 CRM.
Create a new button in the Ribbon using the Ribbon Workbench tool. You can add the button to the subgrid's ribbon or to the form's ribbon.
In the button's properties, specify the JavaScript function as the OnClick event.
Publish the changes to the Ribbon Workbench.
Test the cloning functionality by selecting records in the subgrid and clicking the Clone button.
Here is an example of a JavaScript function that could be used for cloning:
function cloneSelectedRecords(executionContext) { if (executionContext === null) return; var formContext = executionContext.getFormContext(); // Get reference to the subgrid control var subgridControl = formContext.ui.controls.get("your_subgrid_name"); // Get the selected rows in the subgrid var selectedRows = subgridControl.getSelectedRows(); // Iterate through the selected rows for (var i = 0; i < selectedRows.length; i ) { // Get the data for the selected row var rowData = selectedRows[i].getData(); // Create a new record with the same data Xrm.WebApi.createRecord("your_entity_logical_name", rowData).then( function (result) { var newRecordId = result.id; console.log("New record created with ID: " newRecordId); }, function (error) { console.log(error.message); } ); } // Refresh the subgrid to show the newly created records formContext.data.refresh(); }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 74 Super User 2025 Season 2
Daniyal Khaleel 32 Most Valuable Professional
Gerardo RenterÃa Ga... 31 Most Valuable Professional