Is a Deleted Object Deleted Immediately from the DB?

Question

When we delete a Price List, is it really deleted? Or it is marked with deleted flag in the database and stays in the DB for some time (soft delete)?

Answer

User deletes object as per usual. This however does not immediately delete the object and all associated line items and meta data but rather marks (=soft-deletes) e.g., the Price List. This makes the delete operation quick for the user in all cases (esp. for large lists) => fewer UI problems.

A new background job then picks these up and finally wipes all the bits and pieces (items, meta, workflows, etc.).

The notable impact here is that this also means that these items (esp. regarding workflow) may still hang around (i.e., are visible to the user) for up to 1 hour after the deletion until they finally get mopped up. This is by design in this case then.

Line Items in Logics

Until the background job removes them, the Groovy API still returns the line items of a deleted list. api.find() and api.stream() return them for the type codes PLI, XPLI, PGI, XPGI, SIMI, XSIMI and MPLI.

The Groovy API does not return the deleted list itself. api.find("PL", ...) and api.find("PG", ...) skip deleted lists.

To exclude the line items of deleted lists, filter the line items by the ID of a list that exists. Use the pricelistId field for price list items and the priceGridId field for Live Price Grid items.

Groovy
// api.find does not return deleted LPGs
def lpg = api.find("PG", 0, 1, null, Filter.equal("label", "Europe 2026"))[0]
if (lpg) {
    api.stream("XPGI", null, Filter.equal("priceGridId", lpg.id))?.withCloseable { items ->
        items.each { item ->
            // process the item
        }
    }
}

The Query API reads line items only through their price list or Live Price Grid. If that list is deleted, the query fails with an error that the list is not found.