A real estate lease has a dependent association with payment schedules and we are encountering an issue where the dependent payment schedules are not getting deleted when we delete the parent lease.
The real estate lease has a dependent association with payment schedule. When the lease is deleted, platform code also deletes any dependent records. However, you will have to wait for the Cleanup Agent to run for the deletion of dependent records. When you delete the lease record, the lease does not appear in the manager query anymore, but the lease is still waiting in the database for the Cleanup Agent to be run to get deleted completely. After the Cleanup Agent runs to permanently delete the lease, the associated payment line items will be marked for deletion. Then upon the subsequent cleanup activity, these associated records will also be permanently deleted.
It is recommended that the Cleanup Agent run each night and it should never be disabled. Also, it is recommended to terminate the payment schedules before deleting the lease, because the Scheduler Agent may stop the system from cleaning up the payment schedules if the schedule is still active.