When cash receipts and credit memos are processed in Receivables Management, the fully paid documents are not moved to history automatically. They remain in the open RM tables until the RM Paid Transaction Removal routine is ran. This routine can take a while depending on volume of transactions that it is moving. In the past, GP customers would run it with a cutoff date that is a few months prior to the current month. This was to keep more recent documents open in case they need applied differently or voided. The Professional Service Tools Library (PSTL) is a free feature that has a tool called “Receivables Management Transaction Unapply” that moves them back to open where they can be voided or applied differently. This somewhat changes the strategy on the cutoff date that is used with the RM Paid Transaction Removal since we can move history back to open with the tool as needed.
Over the years, there has been interest in having the RM Paid Transaction Removal run automatically with a cutoff date that is dynamically determined based on the current date. The code below can be put onto a SQL Server job and set to run on a desired frequency. The highlighted sections need to be updated with specifics for the environment. The parameters used are to run on all customers. The cutoff date is set 6 months prior.