When performing a restore of a Dynamics database, it is important to note that in certain scenarios Email Sends which have completed may run again after the database restore is complete.
WARNING: When you import a copy of your production environment into your Sandbox, all connection details remain the same as in production. If plugins are still enabled in Sandbox, anything deleted from the sandbox will be deleted from the production account on our cloud and will be irrevocably inaccessible from the production environment.
Understanding Scheduled Email Sends
Email Sends which are scheduled to run in the future use workflows in Dynamics. 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 Advanced Settings > System Jobs in Microsoft Dynamics. The workflow will be in a 'waiting' state.
Take this scenario for example:
- On January 1st an email send is scheduled to run on January 14th. A Dynamics database backup is taken on January 7th. January 14th arrives and the email send executes as desired.
- On January 17th, a user accidentally bulk deletes records in Dynamics. It is determined by the system administrator that a restore of the Dynamics database is the easiest method to recover the data. The administrator restores the Dynamics database backup from the 7th.
- When the database is restored, Dynamics sees that there is a 'ClickDimensions Execute Send' workflow which was scheduled to run on January 14th, which was three days ago. Dynamics 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 Dynamics database). These 'ClickDimensions Execute Send' workflows ultimately make Dynamics communicate with the ClickDimensions servers via the internet.
Things to consider
When performing a restore of a Dynamics 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 Dynamics by going to Advanced Settings > System Jobs and canceling any 'ClickDimensions Execute Send' workflows in a waiting state. This would be the case if you are performing a Dynamics 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 Dynamics organization is restored and enabled.
Recommendations
In a Dynamics on-premise environment, disabling internet connectivity on the Dynamics server where the restored organization is hosted will cause the Email Sends to fail due to lack of connectivity to the ClickDimensions servers.
Dynamics Online and Sandbox copies
With Dynamics 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 Dynamics. You should do the following:
- 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.
- 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 Dynamics.
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.