I didn't intend to write this as an article. Like many of my posts it was simply going to be an answer to a question in the forums but when it grew in length I decided it would work better as an article. But I must stress that these are only my initial thoughts so I would expect that partner experts out there would have many very valid points to raise to complete the answer to the question "how do you remove a component"?
Several articles have been written about the component manager before. Some of the frequently read ones include these
And there are others that discuss the changes made to the component manager in particular versions of Sage CRM. But it appears I have evaded the discussion how to remove a component until now.
But let's start at the beginning. The component manager is essentially a way of applying a set of customizations to Sage CRM. When you run the component it can add new columns, new tables, new screens. It can change the structure of the database and the meta data that controls the look and behaviour of Sage CRM screens.
Because the component manager directly changes the database and the meta data records there is no simple undo. This is consequence of the current design of the tool.
If you look at the example components created by the Sage team that are made available in the Marketplace then you will see that the component has an uninstall option when it is run. This is a flag in the component parameters.
What this does is remove custom elements from the visual interface but it does not change the database structure. The columns that the initial run of the component created are still left in place. The API of the component manager does not offer the ability to remove columns or tables.
You can start to 'back out' the component changes manually but this not the simplest of tasks. If the component changed a value in a row of meta data the historic value is not stored. This means at 'uninstall' the component could not know to what value the meta data should be restored. That is only a decision a human can make.
Note: Each meta data row that has been added or changed by the component will be marked with the component name in the xxxx_component column. This allows you to query the meta data tables, the ones that start with 'custom_xxxxxx' and see which rows were changed by a particular component. BUT if you have edited that structure through the interface with the component manager 'switched on' then you may find the the component label has been overwritten with a different component name as any meta data row can only be associated with a single component.
You can manually change and remove meta data structures from within the Administration screens. This means that the removal of a component should not be a coding task.
The way in which I think I would approach the manual removal of a component is the reverse in which a component add elements. E.g.
- Translations that have been added or updated
- Workflows that have been added or updated
- Reports that have been added or updated
- Table level scripts that have been added or updated
- Container Block items that have been added or updated
- Tab groups that have been added or updated
- Fields on screens that have been added or updated
- Lists/Grids that have been added or updated
- Screen Objects that have been added or updated
- Columns that have been added or updated
- Views that have been added or updated
- Tables that have been added or updated
- Database links that have been added or updated
Note: If you manually remove a field/column then it would be removed from all the screens and lists in which it is used. Please see the documentation: http://help.sagecrm.com
Before embarking on the manual removal of the component you should find out as much information about the component from whoever created it.
You should also view carefully the actual code of the component in the xxxx.es file to try and understand the changes it has made.
And lastly! Do not start changing meta data until you have backed up the system!