---
title: "How to delete data from technical objects?"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5623447554/How%20to%20delete%20data%20from%20technical%20objects%3F"
format: markdown
---
FieldBuddy has a few objects in which data is stored for logging purposes. The objects are not cleaned automatically, cleaning up needs to be done manually.

> ❌ Deleting data from these objects means that the data will be permanently deleted. This can impact support in trying to retrieve data when something failed or trying to understand issues when something went wrong.

> ❌ Data that is deleted can no longer be retrieved.

Are you not sure what you are doing? Please contact support.

The technical objects are:

1. System Log (general logging of errors and activities in FieldBuddy)
2. Mobile Sync Log (all data that is sent and received via FieldBuddy Swift)
3. Changeset (all data that is sent and received via FieldBuddy Mobile)  
This record is used only when FieldBuddy Classic is active, as soon as only FieldBuddy Swift is being used - those no longer represent any value (only historical)
4. Audit Trail (all data that is sent and received via FlexConnect)

## \uD83D\uDCD8 Instructions

Execute the following steps as a **System Administrator**:

1. Open up the development console
2. Execute the the code from the tables below – it will do it in chunks of 5k records, so you might run it few times

> ⚠️ It makes sense to adjust the date/time in order to reflect the period that you want data to be deleted, as well as apply some other filtering if needed

### System Log

```
delete [
  SELECT Id
  FROM FIELDBUDDY__System_Log__c
  WHERE CreatedDate < 2024-01-01T17:36:30.512+02:00
  ORDER BY CreatedDate ASC
  LIMIT 10000
];
```

### Mobile Sync Log

```
delete [
  SELECT Id
  FROM FIELDBUDDY__Mobile_Sync_Log__c
  WHERE FIELDBUDDY__Status__c = 'Processed'
    AND CreatedDate < 2024-01-01T17:36:30.512+02:00
  ORDER BY CreatedDate ASC
  LIMIT 10000
];
```

### Mobile Sync Request

```
delete [
  SELECT Id
  FROM FIELDBUDDY__Mobile_Sync_Request__c
  WHERE CreatedDate < 2024-01-01T17:36:30.512+02:00
  ORDER BY CreatedDate ASC
  LIMIT 10000
];
```

### Changeset (old sync logs for FieldBuddy classic)

```
delete [
  SELECT Id
  FROM FIELDBUDDY__Changeset__c
  WHERE CreatedDate < 2024-01-01T17:36:30.512+02:00
   AND FIELDBUDDY__Status__c = 'Processed'
  ORDER BY CreatedDate ASC
  LIMIT 10000
];
```

### FieldBuddy Swift backups

This one is a bit trickier. It requires a custom checks before deletion of data + permission set assignment

1. Create a Permissionset which has checkbox Query All Data true (some environments have it already) + assign it to the current admin user
2. Run following query and check names of the files (you do not want to delete too much)
3. Check titles of the files + who create those. Those should be matching. If there are un-matching ones - ensure to exclude them from a query
4. Perform a deletion with the adjusted from step 3 query

###   
Audit Trail for Flex Connect

1. Go to **Configuration Manager** of the FlexConnect-app
2. Go to the tab: Remove Audit Trails
3. Select which Audit Trails to be removed, which data range, with objects mapping, and the status

![image-20240611-144058.png](media://b04cb33f-0b89-4935-b6c2-3639cd66fcf1)


## \uD83D\uDCCB Related articles



> Macro (contentbylabel)