Applies to Product - Dynamics 365 for Finance and Operations (on-premises)
What’s happening?
The "Documents" folder within the Reporting Server has been continuously growing in size, necessitating a disk expansion or cleanup approximately once a year. Previous cleanup efforts have resulted in users being unable to access certain attachments in older electronic purchase requests (EPRs).
Reason:
The files in the "Documents" folder may originate from attachments added in the Finance and Operations (F&O) system.
Resolution:
- To validate the source of the files, ask a colleague to add an attachment in F&O to a specific record and check if a new file appears in the "Documents" folder.
- There is no standard way to set a retention policy for attachments in F&O; manual cleanup is required.
- If a function to set retention days for attachments is needed, consider raising the idea in the idea portal for the OP environment or voting on any existing ideas. If many customers share the same idea, the product team may investigate the possibility of implementing it.
- For batch cleanup of attachments, follow this workaround:
- Backup important old attachments and the AXDB to another environment before deletion.
- Identify the attachments to delete and set refrecid to indicate orphaned attachments.
- Use the batch job "Scan for orphaned document references" to scan for orphan attachments daily.
- Once identified, F&O will create a batch job "Deletes a bundle of orphaned document references" to clean up the orphan attachments from the related F&O tables.
- Use the following SQL script to see where the attachment is stored: sql SELECT ACCESSINFORMATION FROM docuvalue dv JOIN docuref dr ON dr.valuerecid = dv.recid WHERE dr.recid = recid;
- After the records are deleted by the daily batch job, delete the related attachments in the "Documents" folder as well.
