Forum Discussion
Delete Survey Data after certain period
- May 25, 2022
ToniS290 the form responses are not tied in to retention policies and, by default, a form owner needs to go into the spreadsheet behind a form and delete all responses. This is prone to people forgetting and it not getting done, opening up the company to possible consequences of GDPR breaches. But you can do this automatically with a flow in Power Automate which can run on a recurrence and regularly delete the responses from your form. This is much more robust than relying on someone to remember to do it! I learnt the method from DamoBird365 who has a great video on this at https://www.youtube.com/watch?v=eq6QRz29q9Q
When you go into Power Automate copy your tenant ID from the address bar. For the trigger I've set a recurence schedule trigger to run once a week but of courase you can set it to a different schedule:
Add a compose action, name it TenantId and paste in the tenant ID you copied earlier.
Next add another compose action and paste in the user id. You get this from Delve -> Me and it's in the address bar. If it's a group form, open the group in Forms and the Group ID is in the address bar.
Next, add a third compose action and paste into it the form ID.
Finally, add a Send an HHTP request to SharePoint action. Set the site address to https://forms.office.com. Set the method to DELETE. In the uri field paste in
/formapi/api/Outputs of your TenantID compose/users/Outputs of your GroupID compose/forms('Outputs of your FormID compose')/responses
Name your flow, save it and test. It will delete all the responses within a few seconds, then it will do so every week from then on.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
ToniS290 the form responses are not tied in to retention policies and, by default, a form owner needs to go into the spreadsheet behind a form and delete all responses. This is prone to people forgetting and it not getting done, opening up the company to possible consequences of GDPR breaches. But you can do this automatically with a flow in Power Automate which can run on a recurrence and regularly delete the responses from your form. This is much more robust than relying on someone to remember to do it! I learnt the method from DamoBird365 who has a great video on this at https://www.youtube.com/watch?v=eq6QRz29q9Q
When you go into Power Automate copy your tenant ID from the address bar. For the trigger I've set a recurence schedule trigger to run once a week but of courase you can set it to a different schedule:
Add a compose action, name it TenantId and paste in the tenant ID you copied earlier.
Next add another compose action and paste in the user id. You get this from Delve -> Me and it's in the address bar. If it's a group form, open the group in Forms and the Group ID is in the address bar.
Next, add a third compose action and paste into it the form ID.
Finally, add a Send an HHTP request to SharePoint action. Set the site address to https://forms.office.com. Set the method to DELETE. In the uri field paste in
/formapi/api/Outputs of your TenantID compose/users/Outputs of your GroupID compose/forms('Outputs of your FormID compose')/responses
Name your flow, save it and test. It will delete all the responses within a few seconds, then it will do so every week from then on.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
RobElliott Hey Rob,
thanks for the very thorough response. I am not too confident in my Power Automate skills, and I got a couple of questions about this:
- Is it possible to make this somehow tenant-wide?
- i.e. User creates a survey -> after 180 days (no matter the responses), the survey data gets deleted or the owner receives an e-Mail to delete their survey
- Can you dynamically retrieve the userId and formId?
Thanks!
- RobElliottMay 25, 2022Silver Contributor
ToniS290 it's tenant-wide anyway, it runs on the schedule against any personal or group form in your tenant. But the user would need to create the flow for each and every form, you can't have just 1 flow for all forms in your tenant.
No you can't dynamically retrieve the userID or FormID.
Rob
Los Gallardos
Microsoft Power Automate Community Super User