//
you're reading...
Dynamics CRM, Dynamics CRM Master

How to clone a record in Dynamics CRM 2013?


One of the common requirements I hear from customers is “can I clone a record in Dynamics CRM?” Usually the need for cloning arises to avoid duplicate data entries and to minimize errors in the process. Well, Dynamics CRM does not provide any out-of-the box feature to clone a record to create another. However, it does have the framework to get the work done.

Here I would provide a very simple way to implement the cloning functionality without writing any code, not even JavaScript!  Don’t believe. Check it out.

The illustrated mechanism works if we just want to clone the direct data fields, but not any related records. For example, we want to clone a lead record to create another however, the connections of the lead record is not required to copy to the cloned record.

To implement such a cloning functionality, we need to create a self-reference for the entity. In our example, we will create a 1: N relationship between lead entity itself.

Step 1: Create a self-referential 1: N relationship

LeadtoLeadRelationship

Step 2: Map the fields to be copied when the clone is created

DataFieldMappings

Step 3 (optional but provides clean implementation): Use Ribbon Workbench* to Hide the “Add Existing Lead” button and rename the “Add New Lead” button to “Clone Lead” along with tool tip etc.. Changes accordingly.

RibbonWorkbench Solution

UpdatingAddNewLeadButton

 
*RibbonWorkbench solution for Dynamics CRM 2013 can be downloaded for free from the following location: http://www.develop1.net/public/Download%20Ribbon%20Workbench%202013.aspx

Step 4: Publish all the customization.

To check the result, now navigate to the Sales | Lead section and pick up a lead record. Then navigate to the associated records section (as shown below). You can find Cloned Leads.

OpenLeadRecord

Click on Cloned Leads. You can see the “Clone Lead” button on the screen.

CloneLeadButton

Click on the Clone Lead button. Bingo! A Quick Create Lead opens up copying the data from the existing record. Our clone functionality is working.

ClonedLeadRecord

Happy Cloning!!

About Dipankar Bhattacharya

Dipankar is a CITA-F, ITIL certified professional specializing Customer Relationship Management (CRM) and Cloud Computing. He is a certified Microsoft Dynamics CRM specialist and Architect and have been working in the field of CRM for enterprise customers across the globe.

Discussion

8 thoughts on “How to clone a record in Dynamics CRM 2013?

  1. Hi Dipankar: What if I created a support contract entity with a related license entity. But I need to clone the support contract which will change the contract number and alienate the licenses which are related by contract number? How would you handle that?

    Posted by Olga Browne | December 1, 2014, 10:55 PM
    • Hi Olga : when you clone a support contract, I’d like to assume that you’d like have a new contract number, after all the cloned record is a different contract altogether.

      As far as related records (N:1 relationships) like License(s) linked to a support contract is concerned; there exists no configuration to copy them over to the cloned record. However, a custom plugin can do the job. When a support contact is cloned, a plug-in can copy the license to the cloned record.

      Posted by Dipankar Bhattacharya | December 2, 2014, 5:54 AM
  2. What a lot a bother for something you can do as standard in salesforce.

    Posted by Tevi Livestain | January 7, 2015, 2:20 PM
  3. Hi Dipankar,

    Very neat technique. My requirement was fullfilled exactly with this implementation. Thank u very much.

    But, the only problem is I am doing this for incident entity and I have a custom auto number plugin that generates unique identifier each time a new incident record gets created. Now, with this approach, the plugin does not get triggered and a system generated auto number is getting created. What do you think I have to tweak to get my plugin triggered even in this approach.

    Thanks

    Posted by roxanna | March 12, 2015, 1:46 AM
  4. Hi Roxana, Is the plug-in synchronous? Check the logic of the plugin…whether it is validating any condition which is not satisfied by the cloned record. Normally, there shouldn’t be any problem with a synchronous auto-numbering plugin.

    Posted by Dipankar Bhattacharya | March 12, 2015, 5:39 PM
    • Yes, it is a synchronous plugin. I think the problem is with the mapping fields. I used Case Title field in the plugin to display the auto number. And when I followed your article to create self referencing relationship, the system generated auto mapping on Case Title field which I cannot delete. I think this is creating confusion in showing the custom auto number. Could this be the issue?
      Thanks for your quick reply. Appreciate it.

      Posted by roxanna | March 12, 2015, 7:36 PM
  5. What about for sub grids….

    Posted by Brandon | October 15, 2015, 7:01 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats

  • 61,049 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 565 other followers

My Book

Follow me on Twitter

%d bloggers like this: