The submitted ShoppingCartOrder entries are for information only. There is no functional need to keep them. To automate a deletion, we suggest:
1. Mark relevant columns of "ShoppingCartOrder" with "Log changes when deleting" and mark "PersonWantsOrg.UID_ShoppingCartOrder" with "Log changes".
Purpose: The deletions will be logged automatically in DialogWatch and will be moved later to the History Database (HDB) so the deletion is available in the future.
2. Create a process to delete the old ShoppingCartOrder entries. This could be done with a "ExecuteSQL" job, which executes such a statement:
where not exists (
-- only submitted ShoppingCartOrders (there must not be ShoppingCartItems)
select 1 from ShoppingCartItem
where UID_ShoppingCartOrder = ShoppingCartOrder.UID_ShoppingCartOrder
and not exists (
-- only ShoppingCartOrders for not active requests
select 1 from PersonWantsOrg
UID_ShoppingCartOrder = ShoppingCartOrder.UID_ShoppingCartOrder
and OrderState in (select OrderState from QER_VPWOOrderState where IsClosed = 0)
Note: please ensure a database backup exists prior to making such changes.
The second part could be adapted, for example, it would be possible to remove ShoppingCartOrder rows for active requests as well and/or add a condition for the lifetime. That could be configured in a custom defined configuration parameter.
We recommend running the statement manually as a "select * from ..." to get a feeling of how many records would be affected.
3. Define a schedule which triggers the process.
Enhancement 34075 has been logged to provide this functionality in a future release of One Identity Manager.