How can I bulk delete Trace Flags?
|Knowledge Article Number||000231445|
|Description||Deleting trace flags one by one through the UI can be tedious and time consuming. In order to easily delete many TraceFlag objects at one time, remove them in bulk using the Developer Console.|
|Resolution||Use the following query in the Developer Console to access the TraceFlag object:
SELECT Id, CreatedDate, CreatedById, ExpirationDate, TracedEntityId, ApexCode, ApexProfiling, Callout, Database, System, Validation, Visualforce, Workflow FROM TraceFlag** Be sure to select the 'Use Tooling API' checkbox before executing the query **
You can then select one or more rows from the Query Grid by clicking them directly. Once the rows are selected, click the 'Delete Row' button in the Query Grid and refresh your org to see the changes reflected. You can then refresh the Debug Logs page to see that multiple trace flags have been removed in the UI as well.
Note: Try to filter the query in advance to match all of the flags you need to delete. For example, you can specify the TracedEntityId, which can be the User Id, Apex Class, or Apex Trigger, and then you can select all of the resulting trace flags for deletion.