CRM 4 to CRM 2011 Migration via Scribe/SQL: Part 3 of 3

by Alex Aquila - Technical Project Manager 5. August 2011 15:42

We recently encountered an issue where we needed to import a large data set from CRM 4.0 to CRM 2011. In CRM 2011, there are no methods available in the SDK that will allow you to modify the createdon, createdby, modifiedon, modifiedby fields.

The baton was passed to me to write a TSQL script that would loop through all the rows in a bridge table and find correlating records in a CRM 2011 target then update certain system protected fields before moving to the next row of data.

The first part of the solution was to have Scribe write this information to a temporary table. The second part is to read this information and populate the necessary fields in CRM.

 Our bridge table had the following schema:

Scribe writes to this table whenever it performs an insert. So, when the scribe import is done running, you have all of the necessary information stored in this table. It is then just a matter of moving it from the temp table to CRM.

Here is the script we used to accomplish this. The idea is to cursor through the rows and update as necessary in CRM. The script was built to run in multiple different environments (development, QA, production) with having to change only the variables at the top.  

 

After running this little gem, we were able to open any of the records and see verified historic data across the board! Win one for the good guys.

Tags:

Categories: CRM 4.0 | CRM 5.0 | Dynamics CRM | Microsoft | Webfortis

Comments are closed

Month List