Cloning An Entity In CRM

by Bill Owens 22. May 2008 18:53
Danny Varghese on 03.26.08 wrote

Intro


We’ve had requests from our clients to “clone” already created records at the click of a button.  The reason is that when users are entering data into numerous records of the same entity every day, where only a few fields may differ, it can be cumbersome.  A great example is we created an entity with over 50 fields and users may create 10-15 records of that entity where 90% field values will be the same.   I’ll explain the approach we took.


Approach


1.       Create a JavaScript function that will open a window to the entity to be cloned to (make the window variable global)


2.       Edit the ISV.config.xml to add a button, and in the configuration, reference the JavaScript function created above


3.     Inside the JavaScript function (you may create other methods as well), call the function to check the status of the new window


4.    When the page is loaded, start mapping from one window to the other as in the second function below


function checkPageState()

{              if (oClonedEntity.document.readyState == 'complete')               {                   cloneEntity();                          return;         }  

  setTimeout('checkPageState()',100);            

}     
function cloneEntity(){            
with(oClonedEntity.document.crmForm)       {             

    //add fields here that you want to copy from one entity to the newly created one

    new_field1.DataValue = crmForm.all.new_field1.DataValue;                  new_field2.DataValue = crmForm.all.new_field2.DataValue;       }                            //finally, close the dialog       

window.close();

} 
5.       After inserting the above code, test it out.  This will be highly beneficial for users, enjoy!

 



Tags: ,

CRM 4.0

Page List

About the author

I work for a consulting firm in Dublin Ohio called Affiliated Resource Group. For the last five years I have been spearheading our Microsoft Dynamics CRM practice. I have a deep appreciation for the Microsoft CRM platform and I am very excited about it. You might even describe me as a Microsoft CRM Advocate. I have many battle scars from my experience with the product and I’m constantly being asked questions about CRM and how-to-do something in it. Hence, this BLOG is to help disseminate that knowledge and information to everyone. As of last year I was posting links to many other blogs to help spread the knowledge, but now with the community.dynamics.com doing that for me, I will be following that practice unless a really juicy article catches my eye. Many people have asked where my post are for the first half of 2010, my company had me posting to another blog and maintain two was near impossible. I am now down to just this blog. So good luck and I hope that this blog may help in some way. If you have suggestions or questions, please email me them.

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 BillOnCRM