Revitalising old demo data with the Simple Date Changer component for Sage CRM

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Revitalising old demo data with the Simple Date Changer component for Sage CRM

  • Comments 2
  • Likes

The Sage CRM installation program has an option to add demo data to the CRM database. Over time, this demo data may become out of date. If you have created your own demo data specific to a particular customer or customization this too may go out of date and there can be a lot of work involved in keeping it relevant. 

I have created a simple component that adds a utility into the Administration screens that avoids the need to re-install Sage CRM in order to get fresh demo data.

The System Administrator can simply pick a new anchor date and the main data tables will have their dates reset against that new date.  Any custom entities and new date fields will also be included in the move.
Members of the Developer Program can download the new component from the folder "DEVELOPER DOWNLOADS AND COMPONENTS".  

You will need to be logged to the community with a profile that has developer rights in order to access this file.  

The component is installed like any component.



You will need to scroll down and 'tick' the disclaimer check box in order to install the component.  I have added this because it makes such profound changes to data that you need to think carefully about the use of the component.



The Simple Date Changer utility is available under the Data Administration screens

Administration -> Data Management


The utility is very simple to use.  All you have to do is to enter a new date.  The current date and time is the default value.

You can enter a date in the future, or in the past and it will reset the dates accordingly and it will be consistent in its behaviour.

Once the 'Shift Dates' button is clicked a series of sql statements are run to identify the tables that have dates that need changing and then the date fields are updated.


In a typical system the date fields in the following tables (plus custom entities) are changed. 

  • Account
  • Activity
  • Address
  • CallList
  • Campaigns
  • CaseProgress
  • Cases
  • Channel
  • Comm_Link
  • Communication
  • Company
  • Email
  • ForecastHistory
  • Lead
  • LeadProgress
  • Library
  • Marketing
  • Notes
  • Opportunity
  • OpportunityProgress
  • Orders
  • Person
  • PricingList
  • ProductFamily
  • Quotes
  • Solutions
  • Users
  • WaveItems
  • Waves

I created the utility using ASP pages rather than the .NET API as I wanted people to be able to easily see the code and to make changes where necessary.

The utility is interesting as a training study for a number of reasons.

  1. It shows how one page can redirect an entry form to another page in order to carry out the processing. 
  2. The code shows how I have handled the submitted date and time.  
  3. The code copes with the different user preferences that determine how the date and time field appears in the interface.  It then switches the date into the standard SQL date and time format.
  4. It uses the CRM QueryObject to interact with both CRM tables (application and meta data) and database information schema views.
  5. The actual update of the data shows a use of an Update From statement.

I am sure that this component is not perfect.  I know it doesn't cover data in tables like Reports and Key Attributes as this was my simple first draft.

But you can take the code and change it in any way you need and you are very welcome to post comments below to suggest changes for when I update this for the next version of Sage CRM.

I hope the component is useful to you and that it helps keep your demos fresh and relevant.

Comments
  • Thanks for providing this tool, Jeff!

  • Jeff this is a very useful utility!  I use this all the time!  Great job as always!