Articles in this section

Keep deleted records in sync

When a record is deleted in the source application, Celigo sync doesn't remove it from the destination table. The merge ingestion mode updates existing rows and adds new ones, but it doesn't delete rows. To keep warehouse tables in line with the source, use one or more of these approaches:

  • Filter on the source's soft-delete flag.
  • Sync the source's list of deleted records, then clean up the destination table in your warehouse.
  • Run a full resync periodically to catch records deleted at the source.

Filter on soft-delete flags

Many applications mark a record as deleted or inactive instead of removing it. The flag lands in the destination table as a normal column, for example:

  • Salesforce: IsDeleted
  • NetSuite: isinactive

In your warehouse, filter on that column to leave deleted or inactive records out of your queries and reports.

Every table that Celigo sync creates also includes a _celigo_deleted column, the soft-delete flag. Celigo sync fills it wherever the source exposes a soft-delete flag, which today is Salesforce's IsDeleted. Other sources' flags, such as NetSuite's isinactive, land as normal columns that you can filter on. A record removed from the source (a hard delete) never sets _celigo_deleted, in any extract mode. For details, see Understand Celigo sync system columns.

Deleted Salesforce records come through with IsDeleted set to true while they're in the Salesforce Recycle Bin, which keeps them for 15 days. Records purged from the Recycle Bin before a run, and records that Salesforce deletes without the Recycle Bin, such as opportunity line items, opportunity team members that are removed directly, and revenue schedules that are replaced when a schedule is re-established, never come through with IsDeleted set to true, so _celigo_deleted isn't set for them. Catch them with a full resync (see Run a full resync periodically).

Sync the deleted-records list and clean up the destination table

Some applications keep a list of deleted records that you can sync next to your main tables. Add the list to your sync as its own dataset, so it lands as its own table:

  • NetSuite saved search: at the top of the sync's source step, select NetSuite saved searches, and then select a saved search of type Deleted Record. See Create a sync from an application's objects.
  • NetSuite JDBC: add NetSuite's standard deletedrecord table as its own dataset, like any other table. Celigo sync doesn't add it for you. Each row is one deleted record: recordid is the record's internal ID, recordtypeid is its record type (for example, salesorder), and deleteddate is when it was deleted. The NetSuite role that the connection uses must be able to see deleted records. The table has no primary key or delta field, so use the All extract mode for this dataset.

Then schedule SQL in your warehouse that deletes the rows listed in the deleted-records table from the destination table. Celigo sync doesn't run this cleanup for you.

For example, to remove deleted sales orders from your sales order table:

DELETE FROM salesorder
WHERE id IN (
  SELECT recordid FROM deletedrecord
  WHERE recordtypeid = 'salesorder'
);

Replace salesorder and id with your destination table and its ID column.

Note: NetSuite's deleted-records list covers only the record types NetSuite tracks for deletion, and it has no line-level IDs, so deleted transaction lines don't appear. For those, run a full resync periodically.

Run a full resync periodically

How you catch records deleted at the source depends on the dataset's ingestion mode:

  • Replace with the All extract mode: every run reloads the full table, so rows deleted at the source drop out. With Delta, Replace would keep only the records that changed in that run. Replace deletes the destination table's existing records, so don't use it for a table that holds data the source no longer returns.
  • Merge: run a full resync of the dataset. Scheduled runs are always standard runs, so start the resync yourself:

    1. Select Run on the sync.
    2. Under Run sync with, choose to run only selected objects, and then select the dataset.
    3. Under Run type, choose a full resync, and then select Start.

    For details, see Run the sync on specific objects only. The resync stays in merge mode and stamps every row it writes with that run's _celigo_extracted_at. A full resync alone doesn't remove rows deleted at the source, because merge never removes rows. After the resync succeeds, delete or flag the rows it didn't write with a transformation in your warehouse: rows whose _celigo_extracted_at is older than the resync's start, or whose _celigo_job_id doesn't match the resync.

Each full resync counts the whole table's volume, so run one only as often as you need to. For how each extract and ingestion mode works, see Choose an extract and ingestion mode.

Learn more