- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
The European Union's General Data Protection Regulation (GDPR) outlines how to manage and protect personal data regardless of where it is sent, processed or stored. A typical use case maybe deleting attachments that are outdated or unnecessary on a particular table.
There are numerous methods available in the ServiceNow Platform for deleting attachments. A good architectural principle is to use Flow Designer and the action Delete Attachments to achieve this.
To look up and delete records in Flow Designer you can use a Lookup Records action to find the desired records. As there are multiple records you need to loop through the results For Each before deleting, using the Delete Attachment action to remove them. You then use the data pill from the Lookup Records action as input for the Delete Attachment action.
1. Add a Lookup Records action
- In your flow, click the plus (+) icon to add a new action.
- Search for and select the Lookup Records action.
- Configure the action by specifying the table you want to search in and the criteria to find the record(s) you want to delete the attachments for.(table_name is <table name> AND state is closed)
2. Add a For Each Flow Logic
- Lookup Records action is designed to return multiple records, you will need to use a For Each flow logic to process them individually.
- Below the Lookup Records action, add a new For Each flow logic and select in the Items field the data pill (the output variable) from the Lookup Records action. (Records).
3. Add a Delete Attachment action
- Place the Delete Attachments action inside the For Each loop. This will delete each attachment record found in the loop.
- Select in the Source Record field the data pill (the output variable) from the For Each flow logic.
- Tick the checkbox Delete All Attachments?, otherwise you will have to specify an attachment file name.
- Record Variables: The Lookup Records action returns data pills that you can use in subsequent actions.
- Referencing Correctly: Always ensure you are referencing the correct record from the lookup to delete the attachment.
- 196 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.