back to knowledgebase

How to write data retention rules to ensure attachments are removed from records?

Updated: 05 February 2019 13:01:52 OpenCRM::Settings

Because of the way most attachments are linked to records in OpenCRM via a document record, and the fact that document records can exist in their own right with their own attachments linked, ensuring that linked attachments are removed from their parent records requires a few additional steps / workflow rules. 

You may also need to consider that a record will have linked emails which in turn will have linked attachments. 

A. To wipe linked attachments from a record (e.g. a Contact record, Company record etc)

1. You will need a data retention rule on the record type you wish to remove attachments
2. Add conditions to specify which records of this type (what criteria) to run the rule on
3. Add an action of "Update Linked Clear Selected FIelds", that has a module of "Documents" 
4. Choose the "Attachment" field (or choose action of "Update Linked Clear All Fields")

NB - If you only wish to clear the attachment field on documents linked to a record of certain criteria, you could add extra step/s in here so that rather than "Update Clear Selected" on documents, you just did an "Update Linked", use this to set a field on the document and then have a second rule on documents which checks for this, and any other criteria if you only wanted to target attachments on documents of certain criteria. 

B. To wipe attachments linked to an email linked to a record 

Please note that a data retention rule which updates emails linked to a record and sets the attachment field to blank will only remove the attachments from those emails affected by the data retention rule. The attachment file will remain linked to it's document record, searchable in the documents module and linked to any other records or emails that the attachment was linked to. This may be desirable, however if you want to make sure any attachments linked to emails linked to a record are removed completely, then an extra step/rule is needed. 

The attachments could be linked to other records not directly affected by the data retention rules. They will be removed from those records as well using the following workflow.

NB, steps 1 to 4 could be added to the same rule as set up for (A).

1. You need a data retention rule on the record type you wish to remove attachments that are linked to emails
2. Add conditions to specify which records of this type (what criteria) to run the rule on
3. Add an action of "Update Linked" that has a module of "Emails" 
4. Use this rule to set a field on the linked emails, e.g. Subject = "Wipe Attachments"admin    
5. You will need a second data retention rule on the "Emails" module
6. This will need a condition to pick up emails which match the way in which the emails you wish to clear were updated in step (4)
7. Add an action of "Update Linked Clear Selected FIelds", that has a module of "Documents" 
8. Choose the "Attachment" field (or choose action of "Update Linked Clear All Fields")

Rate This Article
  • 1 star
  • 2 star
  • 3 star
  • 4 star
  • 5 star
Feedback and Comments
captcha code  


You may also be interested in: