Stage 9 of 17
One flow: DToDLab005-ExpiryReminder. It runs daily, checks for training records approaching expiry at three intervals (60, 30, and 7 days), sends email reminders to the employee and their manager, and prevents duplicate reminders using flag columns. This stage explains the date logic in full.
Why "exactly N days" rather than "within N days"?
The flow runs daily. If you filter for records where ExpiryDate is within 60 days (i.e. ExpiryDate ≤ today + 60), the flow would find the same records every day from day 60 until expiry. Without the reminder flags, it would send a new reminder every single day.
The reminder flags (Reminder60Sent, Reminder30Sent, Reminder7Sent) solve this — but they require the filter to be precise. The filter must find records where ExpiryDate is exactly today + 60 days (not within 60 days). This way, each reminder is triggered once, on the correct day.
// 60-day reminder filter (OData filter query)
ExpiryDate eq '@{formatDateTime(addDays(utcNow(), 60), 'yyyy-MM-dd')}'
// AND the reminder has not already been sent
AND Reminder60Sent eq 'No'
// Combined filter
ExpiryDate eq '@{formatDateTime(addDays(utcNow(), 60), 'yyyy-MM-dd')}' and Reminder60Sent eq 'No'
Date format matters
What about weekends?
The flow runs every day including weekends. If a training record expires on a Monday and the 60-day threshold falls on a Saturday, the flow will not find it on Saturday (the flow runs, but no records match "exactly 60 days"). It will find it on Sunday if the threshold is Sunday, or miss it entirely if the threshold falls on a weekend day when no one is checking email.
For a lab environment, this is acceptable. For a production system, consider using a "within N days" filter combined with the reminder flags — the flag ensures the reminder is sent only once, even if the flow runs multiple times within the window.
Create a new scheduled cloud flow
Navigate to make.powerautomate.com. Select Create → Scheduled cloud flow. Name: DToDLab005-ExpiryReminder. Starting: today. Repeat every: 1 Day. Select Create.
Why
A scheduled flow runs automatically at the defined interval without any user action. This is the correct trigger for a daily check.
Expected Result
A new flow is created with a Recurrence trigger set to run every 1 day.
Configure the Recurrence trigger timezone
Select the Recurrence trigger. Expand Show advanced options. Set Timezone to "(UTC+00:00) Dublin, Edinburgh, Lisbon, London". Set Start time to today's date at 07:00:00.
Why
Without a timezone setting, the flow runs at 07:00 UTC. In British Summer Time (BST, UTC+1), this means the flow runs at 08:00 local time — acceptable. In winter (GMT, UTC+0), it runs at 07:00 local time. Setting the timezone explicitly ensures consistent behaviour.
Expected Result
The Recurrence trigger shows Timezone: (UTC+00:00) Dublin, Edinburgh, Lisbon, London.
Add a Scope action and name it "60-day reminders"
Select New step → Scope. Rename the scope to "60-day reminders". All subsequent steps for the 60-day check will go inside this scope.
Why
Grouping related steps in a Scope makes the flow easier to read and maintain. It also enables failure handling — you can configure a step to run if the scope fails.
Expected Result
A Scope action named "60-day reminders" is added to the flow.
Inside the scope: Add "Get items" from SharePoint (60-day filter)
Inside the "60-day reminders" scope, add a SharePoint "Get items" action. Site Address: Training Register site URL. List Name: TrainingRecords. Filter Query: ExpiryDate eq '@{formatDateTime(addDays(utcNow(), 60), 'yyyy-MM-dd')}' and Reminder60Sent eq 'No'. Top Count: 100.
Why
This retrieves only the training records that expire in exactly 60 days and have not yet had a 60-day reminder sent. The Top Count of 100 limits the results — increase if you have more than 100 records expiring on the same day.
Expected Result
A "Get items" action is configured with the filter query. When tested with a record expiring in 60 days, it returns that record.
Add "Apply to each" over the 60-day results
Add an "Apply to each" action. Select output from previous step: value (from the Get items action). Inside the Apply to each, add two actions: (a) Send an email, (b) Update item.
Why
The "Apply to each" loop processes each matching record individually. Each record gets its own email and its own flag update.
Expected Result
An "Apply to each" loop is added, iterating over the results of the 60-day Get items action.
Inside Apply to each: Send an email (60-day reminder)
Add a "Send an email (V2)" action from the Office 365 Outlook connector. To: @{items('Apply_to_each')?['Employee']} (the employee email from the lookup). CC: @{items('Apply_to_each')?['ManagerEmail']}. Subject: Training reminder — @{items('Apply_to_each')?['Course']} expires in 60 days. Body: include employee name, course name, expiry date, and a prompt to book renewal.
Why
The employee receives the reminder directly. The manager is copied so they are aware and can follow up if needed.
Expected Result
An email is sent to the employee and copied to the manager when the flow runs for a matching record.
Inside Apply to each: Update item — set Reminder60Sent = Yes
Add a SharePoint "Update item" action. Site Address: Training Register site URL. List Name: TrainingRecords. ID: @{items('Apply_to_each')?['ID']}. Reminder60Sent: Yes. Leave all other fields as they are (use the dynamic content from the current item).
Why
Setting Reminder60Sent = Yes prevents the flow from sending the same reminder again tomorrow. This is the duplicate prevention mechanism.
Expected Result
After the flow runs, the Reminder60Sent column for the matching record is set to Yes.
Repeat steps 3–7 for 30-day and 7-day reminders
Add two more Scope actions: "30-day reminders" and "7-day reminders". Inside each, add a Get items action with the appropriate filter (addDays(utcNow(), 30) and addDays(utcNow(), 7) respectively), an Apply to each, a Send email, and an Update item setting the appropriate reminder flag.
Why
The same pattern applies for all three reminder intervals. Repeating the pattern ensures consistent behaviour across all three.
Expected Result
Three scope actions: "60-day reminders", "30-day reminders", "7-day reminders". Each contains a Get items, Apply to each, Send email, and Update item.
Add a top-level Scope for failure handling
Wrap all three reminder scopes in a top-level Scope named "All reminders". Add a "Send an email" action after the scope, configured to run only if the scope fails (select "Run after" → "has failed"). Send to: the L&D team email. Subject: ALERT — DToDLab005-ExpiryReminder flow failed. Body: include the flow run URL.
Why
If the flow fails silently, reminders are not sent and no one knows. The failure alert ensures the L&D team is notified immediately so they can investigate and send manual reminders if needed.
Expected Result
A failure alert email is sent to the L&D team if any step in the flow fails.
Test the flow
Create a test training record with ExpiryDate = today + 60 days and Reminder60Sent = No. Select Test → Manually → Run flow. Check the email inbox for the reminder email. Check the training record — Reminder60Sent should now be Yes. Run the flow again — verify no second email is sent (Reminder60Sent is already Yes).
Why
Testing confirms the flow works correctly and that the duplicate prevention mechanism is functioning.
Expected Result
One reminder email received. Reminder60Sent = Yes after the first run. No second email on the second run.
To: [Employee Email]
CC: [Manager Email]
Subject: Training reminder — [Course Name] expires in 60 days
Dear [Employee Name],
This is a reminder that your certification for [Course Name] is due to expire on [Expiry Date] — in 60 days.
Please book and complete your renewal before the expiry date to remain compliant.
If you have already renewed this certification, please send your certificate to the Learning & Development team so your record can be updated.
If you have any questions, please contact the L&D team.
This is an automated reminder sent by the Training Register system.
Use the same template for 30-day and 7-day reminders, changing "60 days" to "30 days" or "7 days" accordingly.
| Day | ExpiryDate | Days remaining | Flow runs? | Reminder60Sent before | Email sent? | Reminder60Sent after |
|---|---|---|---|---|---|---|
| Day 1 | 01/06/2025 | 61 | Yes | No | No (61 ≠ 60) | No |
| Day 2 | 01/06/2025 | 60 | Yes | No | Yes ✓ | Yes |
| Day 3 | 01/06/2025 | 59 | Yes | Yes | No (already sent) | Yes |
| Day 4 | 01/06/2025 | 58 | Yes | Yes | No (already sent) | Yes |
The reminder is sent exactly once — on Day 2, when the days remaining equals exactly 60. On Day 3 and beyond, the filter finds the record (days remaining is less than 60) but Reminder60Sent is already Yes, so the filter excludes it.
Need more help with the concepts?
Visit DosToDigital for guides, templates, and deeper explanations.