Considerations when performing a database restore or Sandbox copy/reset for a CRM system integrated with ClickDimensions

When performing a restore of a CRM database, it is important to note that in certain scenarios Email Sends which have completed may run again after the database restore is complete.

Understanding Scheduled Email Sends

Email Sends which are scheduled to run in the future use workflows in CRM.  These workflows wait until the date/time they are supposed to execute.  Once the date/time is reached, the workflow proceeds with the email send.  These email sends can be viewed by going to Settings > System Jobs in Microsoft Dynamics CRM.  The workflow will be in a ‘waiting’ state.

db-restore-workflow

Take this scenario for example:

  • On January 1st an email send is scheduled to run on January 14th. A CRM database backup is taken on January 7th.  January 14th arrives and the email send executes as desired.
  • On January 17th, a user accidently bulk deletes records in CRM. It is determined by the system administrator that a restore of the CRM database is the easiest method to recover the data.  The administrator restores the CRM database backup from the 7th.
  • When the database is restored, CRM sees that there is a ‘ClickDimensions Execute Send’ workflow which was scheduled to run on January 14th, which was three days ago. CRM immediately executes the workflow, causing the email send which ran prior to the database restore to run again.

When a backup is taken, any Execute Send workflows which have not met the ‘send on’ date will run if the database is restored AFTER that date (i.e., the Workflow instance is in a ‘Waiting’ state in the backup of the CRM database).

These ‘ClickDimensions Execute Send’ workflows ultimately make CRM communicate with the ClickDimensions servers via the internet.

Things to consider

When performing a restore of a CRM database, it’s important to be aware of any Email Sends which may be in a waiting state in the backed up database.  These will either execute when the database is restored OR remain in a waiting state.  This will depend on the date of the backup, the date of the restore, and the date the Email Sends are scheduled to take place.

A way to prevent an Email Send from running from a restored database which has not run yet is to cancel the waiting workflow.  This can be done in CRM by going to Settings > System Jobs and canceling any ‘ClickDimensions Execute Send’ workflows in a waiting state.  This would be the case if you are performing a CRM Online restore to a Sandbox instance and don’t want these to run in both environments.

For Email Sends which were scheduled to run at a particular date and time which is prior to the restore, these workflows will run immediately when the CRM organization is restored and enabled.

Recommendations

In a CRM on-premise environment, disabling internet connectivity on the CRM server where the restored organization is hosted will cause the Email Sends to fail due to lack of connectivity to the ClickDimensions servers.

CRM Online and Sandbox copies

With CRM online, it is easy to create a copy of your production database which includes all your data into a Sandbox organization.  When doing this, it is important to remember that ClickDimensions is tightly integrated with CRM. You should do the following:

  1. Review any ‘ClickDimensions Execute Send’ workflows in a waiting state prior to creating a copy of your production database.  These should be allowed to complete or be cancelled before you make a copy of your production environment.
  2. Once you have made the copy to a Sandbox org, register the sandbox org for its own ClickDimensions solution and install it, in order to overwrite the production Account Key that is embedded throughout CRM.

Note that you will not be able to delete or update many ClickDimensions records from the Sandbox org. If you try to do this before installing a ClickDimensions solution that is specific to the Sandbox org, you run the risk of deleting or updating your production configurations that are stored in the ClickDimensions cloud application. If you try to do this after you have installed a Sandbox-specific solution, you will encounter an error, because your Sandbox account will not have the corresponding records in the ClickDimensions cloud application.

About Matt

Director, Technical Solutions at ClickDimensions
Microsoft Dynamics CRM MVP
Author, The Microsoft Dynamics CRM 2011 Administration Bible