Stage 17 of 17

Stage 17 of 17 — Final Challenge

The Retention Challenge

The Visitor Management system collects personal data about visitors. UK GDPR requires that personal data is not kept longer than necessary. This challenge asks you to design and build an automated retention process that deletes visitor records after the approved retention period.

Important — Read This First

The retention period used in this challenge (12 months) is a fictional value created for learning purposes only. It is not legal advice. In a real organisation, the retention period for visitor records must be determined by the organisation's Data Protection Officer in accordance with applicable law, regulatory requirements, and the organisation's own data retention policy. Do not use the retention period from this lab in a real application without consulting your organisation's DPO.

The Brief

Message from Fatima Al-Hassan, Data Protection Officer

From: Fatima Al-Hassan, Data Protection Officer

Subject: Visitor Management — Retention Automation

Priya, the system is working well. I have one outstanding concern: the retention process. At the moment, you are manually reviewing the Visits list each month and deleting records older than 12 months. This is not sustainable, and there is a risk that records will be missed.

I need an automated process that: (1) identifies visit records where the ExpectedDate is more than 12 months ago; (2) deletes those records automatically; (3) creates an audit log entry recording what was deleted and when; and (4) handles exceptions — some records may need to be retained beyond 12 months for legal reasons.

Please design and build this. I want to see the requirement, the data rule, the automation, the exception process, the audit log, and the security controls.

Fatima

Your Design Tasks

Task 1 — Write the Retention Requirement

Write a formal requirement for the automated retention process. Your requirement must specify:

  • ▸What triggers the deletion (time-based: 12 months from ExpectedDate)
  • ▸What is deleted (the visit record)
  • ▸What is retained (the audit log entry)
  • ▸The exception process (records flagged for extended retention must not be deleted)
  • ▸Who can flag a record for extended retention
  • ▸The frequency of the automated process (daily, weekly, monthly?)

Write your requirement here

Task 2 — Design the Data Rule

Design the data changes needed to support the retention process. You will need to add fields to the Visits list. Consider:

  • ▸A field to flag records for extended retention (e.g. RetainUntil: Date)
  • ▸A field to record the reason for extended retention (e.g. RetentionReason: text)
  • ▸A field to record when the record was deleted from the audit log (e.g. DeletedDate: Date)
  • ▸A separate Retention Audit Log list to record deletions

Design the Retention Audit Log list. What columns does it need?

Design your audit log columns here

Task 3 — Build the Retention Flow

Build a Power Automate flow named DToDLab004-RetentionProcess. The flow must:

  1. 1.Run on a schedule (you decide the frequency — daily or monthly).
  2. 2.Get all visit records from the Visits list where ExpectedDate is more than 12 months ago.
  3. 3.For each record: check whether the RetainUntil field is set and is in the future. If yes: skip the record (do not delete). If no: proceed to deletion.
  4. 4.For each record to be deleted: create an entry in the Retention Audit Log list (record the VisitID, VisitorName, ExpectedDate, DeletedDate, and the reason for deletion).
  5. 5.Delete the visit record from the Visits list.
  6. 6.Send a summary email to the DPO (Fatima Al-Hassan) listing how many records were deleted and how many were skipped.

Common Mistake

The "Delete item" action in Power Automate requires the connection to have Full Control or at least Edit permission on the SharePoint list. Ensure the flow connection is authenticated as the IT Manager or a service account with the appropriate permission.

Task 4 — Design the Exception Process

Some visit records may need to be retained beyond 12 months. Design the exception process:

  • ▸Who can flag a record for extended retention? (Recommendation: only the DPO or an Administrator)
  • ▸How do they flag it? (Recommendation: set the RetainUntil field to the extended retention date, and enter a reason in RetentionReason)
  • ▸How does the retention flow know to skip the record? (The condition in step 3 of the flow)
  • ▸What happens when the extended retention period expires? (The flow will delete the record on the next run after RetainUntil)
  • ▸How is the exception documented? (The RetentionReason field provides the audit trail)

Task 5 — Security Considerations

The retention process deletes personal data. This requires careful security controls:

  • ▸Only the flow (running as the IT Manager or service account) should be able to delete records. No other user should have Delete permission.
  • ▸The Retention Audit Log must be read-only for all users except the flow. No user should be able to delete audit log entries.
  • ▸The DPO must receive the deletion summary email for every run — this is the oversight mechanism.
  • ▸The flow must not delete records that are flagged for extended retention, regardless of the ExpectedDate.

Task 6 — Write and Execute Test Cases

Write at least 3 test cases for the retention process. Your test cases must cover:

  • ▸A record that is older than 12 months and has no RetainUntil flag — it should be deleted.
  • ▸A record that is older than 12 months but has a RetainUntil date in the future — it should NOT be deleted.
  • ▸A record that is less than 12 months old — it should NOT be deleted.
  • ▸Verify that the audit log entry is created for each deleted record.
  • ▸Verify that the DPO receives the summary email.

Write your test cases here

Hints — Only Read If You Are Stuck

Lab Complete

DTOD-004 Complete

You have completed the full DToD Lab Method for DTOD-004 — Visitor Management. You have built a complete Power Apps canvas app with a 6-status lifecycle, two automated flows, a data minimisation approach, and a two-layer security model — working through all 17 stages from business brief to retention challenge.

17

Stages completed

25

Requirements written

16+

Test cases executed

Next: DTOD-005

Need more help with the concepts?

Visit DosToDigital for guides, templates, and deeper explanations.

DosToDigital
DToD Labs

Learn it. Build it. Make it work.

A DosToDigital Project

About DToD Labs

Practical technology learning for Microsoft 365 and Power Platform. Build real business solutions from real business problems.

Learn the concepts at DosToDigital. Put them into practice at DToD Labs.

DToD Labs provides practical learning projects for educational purposes. Microsoft services, interfaces, licensing and product capabilities change over time. Always check current Microsoft documentation and licensing before implementing a solution in a production environment. All organisations, business scenarios and data used in DToD Labs are fictional. Learners should not use confidential employer, customer or personal information when following DToD Labs exercises.

© 2026 DToD Labs — A DosToDigital Project