Sometimes you may feel the need to do some CRM clean up. We’ve already covered one example of this in our blog on How to “Delete” a User in Dynamics CRM. In this blog, we’ll focus on why you may want or need to completely remove a field from your CRM database. You might want to do this because:
- The field is no longer needed
- The field was created incorrectly
- The field is never used
- The field has the wrong prefix
- The Display name has completely changed and the schema name no longer easily identifies the field
These are just a few examples that my cause you to say, “Lets clean this up!!”
Before you begin, always remember to publish ALL Customizations or at least all customizations for the Entities that you will be removing the fields (Attributes).
BACKUP your customizations and SQL Database – Remember, DELETE is permanent. If you delete a field, you delete all data contained in that field as well. The backup of the customization file is only going to keep a copy of the deleted attributes, NOT the data that is contained in each. The backup of the CRM SQL Database will give you both, but will be a “snapshot” of the database from the point in time the backup is taken.
Make sure that all fields that you will be removing are NOT on the published form. Example: Fields are not on the Main Form, Navigation Pane, Header area, Footer Area OR in any published View for that entity OR… a related entity. (This is an easy one to forget about. Example: Showing a field from the Account Entity in a Contact View – What type of Account does this Contact work for.)
Ask yourself one more time “Does this field contain data that I/we will need again in the future?” If your answer is an absolute “NO”, then proceed. If you cannot answer this question with an Absolute “NO”, then you still have a few options:
- Remove the field from the form so that users cannot easily see the field or enter new data into it, at the same time preserving the data for a later date if/when it is needed. (You can always remove it later after you insure it is no longer needed)
- Make the field “Non-Searchable.” Turning off the ability to search for this field will remove the field from being used in Advanced Finds (Going forward) and Workflows (Going forward).
- Moving the data contained in this field to another location (Example: Notes, or a newly created field that will hold the data from this old field), then removing the old field once the data has been preserved in another location.
Delete the field(s). In the Configuration Area in the fields list for the Entity, you will notice that you can select a field (Attribute) or multiple Fields using the checkboxes to the left of the fields.
Selecting Fields for deletion, then clicking the “X” button, will prompt you to confirm the deletion.
Clicking “OK” completes the deletion process.
If you accidentally try to remove a field that is still on a Published form, you will receive a message similar to this:
By clicking the blue “Details” hyperlink in the dialog box above, you will be able to easily see why the field could not be deleted.
The items in the screenshot above will need to be corrected before the field can be deleted.
If you are trying to delete more than one field at a time, and one or more of the selected fields cannot be deleted, you will receive an error like this:
All selected Fields that COULD be deleted, will be, but all fields that were still required by the entity will remain behind. You will need to access each remaining field individually to determine why it could not be deleted.
So there’s your clean-up tip of the day on deleting attributes from CRM 2011!