Search code examples
salesforcesalesforce-lightning

How do I remove entire tables from Salesforce?


I want to remove entire tables from Salesforce data that I am no longer using. I also want to prevent Salesforce from writing to these tables moving forward. Where do I start?


Solution

  • If it's your own custom tables you should be able to delete them. Hit delete action next to the table name in object manager and see what explodes?

    The rule of thumb is "if you can create it straight in production without running a deployment process - you should be able to delete it". So if by "prevent Salesforce from writing to these" you mean flows, workflows, process builder... - they'll stop your delete, you'll have to get rid of them first before deleting the table itself - but should be relatively easy if repetitive.

    It gets more interesting if you have code (triggers, classes, aura/lwc). You'll need to delete them using a special deployment command, changesets are useless. You can try to craft your own so-called destructiveChanges.xml (it'll be documented in metadata API guide) and try to deploy it even without any developer tools (for example with workbench.developerforce.com) but might be better idea to poke developer to do it. Identify dependencies and edit the code / delete classes as needed.

    If it's custom tables but not your own (coming from managed package) - maybe packag has some config options, worst case uninstall it?