Delete data

The following video provides an overview of the Bulk Record Deletion feature.

The bulk deletion feature helps you to maintain data quality and manage the consumption of system storage in Common Data Service for Apps by deleting data that you no longer need. It allows removal of a large amount of specific, targeted data on a schedule.

The following are common scenarios where the bulk deletion feature could be useful.

Stale data

As the system grows and over time, data entries may become stale. For example, consider large numbers of leads acquired as a result of a massive marketing campaign targeting specific events. As the event passes, leads that haven’t been actioned on yet, become obsolete. Bulk delete in this example would utilize a view that returns all leads for this marketing campaign that are still active.

In another example, it may be safe to assume that any email activities older than seven years are no longer required to be kept in Common Data Service for Apps. A simple view returning all emails older than seven years would allow to run bulk deletion job, removing the records including attachments and thus potentially freeing significant storage space.

Irrelevant data

Bulk deletion jobs can be used to delete data that is no longer relevant to the business. For example, business may have opened a new engineering subsidiary and extended their Common Data Service for Apps to deal with specific matters of that department. Later on, the engineering business is sold, and parts of the Common Data Service for Apps are no longer relevant or required. In fact, it’s not uncommon for the company to be legally obliged to delete any records in relation to the sold business. In this instance you would use a number of bulk delete jobs to clean up all entities from the solution.

Sample or test data

When performance of the system is tested, often large volumes of data are imported into Common Data Service for Apps to simulate the production workloads. When tests are complete and data no longer required, a set of bulk delete jobs can be used to remove unneeded test or sample data.

Erroneous data

Often large volumes of data are imported into Common Data Service for Apps from other systems. If mistakes are made, and data is not imported correctly, bulk delete would allow easy cleanup.

Test or troubleshooting data

During testing of workflows (or by mistake), a flag may be set to retain job entries for successfully completed jobs. That would cause the system jobs log to grow. Once testing is complete (or error is spotted by detecting abnormal size of the log), successful log entries can be deleted from the system.

During the plugin and custom workflow activity troubleshooting, developers may request for the plug-in logging to be enabled.

Screenshot of the System Settings for workflow tracing

Depending on the size and complexity of the deployment this setting may cause the trace log to grow very fast. Once troubleshooting is complete, and the flag is reset, you can use the bulk deletion job against the traces entity to delete any log entries related to the plug-ins.

Screenshot of the search criteria being defined

From time to time you may need to delete a group of data. This may be sample records or stale data or operational data within a limited purpose that you don’t want to hold space in your system. Bulk delete jobs are a simple way to remove data. These jobs can be scheduled to run automatically at specified intervals or configured individually as needed.

Records to be deleted are gathered through a query that is configured just like an advanced find. This query filters the record to be deleted. In recurring bulk delete jobs, this dynamic list is important for finding the records appropriate for deletion at the time. Most commonly these queries include a date field in addition to other fields to filter the records.

Screenshot showing defining the search criteria for the deletion

Several options are available during the configuration of a bulk delete job:

  • Enter a name that reflects the criteria of the query, so you will remember what was deleted when referencing the bulk delete job logs.

  • Bulk delete jobs can be run immediately but are commonly scheduled to run after hours to not impact user productivity.

  • By checking this box and selecting a frequency the bulk delete job will run automatically in the future.

  • Bulk delete jobs can send an email to the administrator and another email address after the job is complete.

Screenshot showing the options for naming and scheduling the bulk delete job

Security

To run a bulk delete job, a user must have the bulk delete privilege as well as the delete privileges for the specific entity types of the records being deleted. The user must also have read permissions for the records.

Considerations

  • If a bulk delete job fails, any records successfully deleted before the failure remain deleted and are not rolled back.

  • Bulk delete jobs will trigger delete actions specified by cascade rules of that entity’s relationships. This means that if you bulk delete account records, you may also be automatically deleting child records, depending on your cascade rule settings for accounts.

  • Delete actions can trigger workflows, business rules and other automations if they are set to trigger on delete of that record type. Using the bulk delete wizard could trigger these processes in mass and cause performance issues.