Stage 9 of 17

Stage 9 of 17

Automate

3 Power Automate flows: contract review reminders (180/120/90/60/30 days) with duplicate-notification prevention, risk rating calculation, and overdue action reminders. Includes a detailed explanation of the ReminderSentFlags technique.

Important: These Are Illustrative Reminder Dates

The reminder dates in this lab (180, 120, 90, 60, 30 days) are illustrative. In a real contract management system, the review start date should be driven by the contract's specific notice period and the complexity of the renewal process — not a fixed schedule. A critical contract with a 90-day notice period should trigger a review at least 180 days before expiry. A low-value contract with a 30-day notice period may only need a 60-day reminder. Use the reminder dates as a starting point and adjust them to match the organisation's actual contract management process.

Flow 1 — DToDLab012-ContractReminder

DToDLab012-ContractReminder

Scheduled — Daily 07:00

Sends review reminders at 180, 120, 90, 60, and 30 days before contract expiry. Prevents duplicate notifications using the ReminderSentFlags field.

The Duplicate Notification Problem

This flow runs every day. Without duplicate prevention, it would send a "180 days" reminder every day for the entire period when a contract is between 180 and 121 days from expiry — that is 60 emails for a single milestone. The ReminderSentFlags field solves this: once a reminder has been sent for a milestone, the milestone is recorded in the field and the flow skips it on subsequent runs.

How ReminderSentFlags Works

The ReminderSentFlags field on the Contracts list stores a pipe-delimited string of reminder milestones that have already been sent. For example:

"180|120"

This means the 180-day and 120-day reminders have been sent. The 90, 60, and 30-day reminders have not yet been sent.

Before sending a reminder, the flow checks whether the milestone is already in the ReminderSentFlags string. If it is, the flow skips it. If it is not, the flow sends the reminder and appends the milestone to the string.

The check uses the contains() expression: contains(items('Apply_to_each')?['ReminderSentFlags'], '180')

1

Recurrence trigger

What

Trigger the flow every day at 07:00.

Why

The flow must run daily to check all contracts and send reminders on the correct day.

Interval: 1
Frequency: Day
At: 07:00
Time zone: (UTC+00:00) Dublin, Edinburgh, Lisbon, London

Expected Result

The flow runs automatically every day at 07:00.

2

Get items — Contracts list

What

Get all contracts from the Contracts list where Status is Active, Under Review, or Renewing.

Why

Only active contracts need reminders. Terminated, Expired, and Draft contracts should be excluded.

Site: Supplier & Contract Management
List: Contracts
Filter Query: Status eq 'Active' or Status eq 'Under Review' or Status eq 'Renewing'

Expected Result

The action returns all active, under-review, and renewing contracts.

3

Apply to each — loop through contracts

What

Loop through each contract returned by the Get items action.

Why

Each contract needs to be checked individually against the reminder milestones.

Expected Result

The loop processes each contract in turn.

4

Compose — calculate DaysToExpiry

What

Calculate the number of days between today and the contract end date.

Why

The DaysToExpiry value is used to determine which reminder milestone applies.

Expression: div(sub(ticks(items('Apply_to_each')?['EndDate']), ticks(utcNow())), 864000000000)

Expected Result

The Compose action outputs the number of days to expiry as an integer.

5

Condition — check each milestone (180, 120, 90, 60, 30)

What

For each milestone, check two conditions: (1) DaysToExpiry is within the milestone window, and (2) the milestone has not already been sent (not in ReminderSentFlags).

Why

This is the duplicate prevention check. If the milestone is already in ReminderSentFlags, the reminder has already been sent and must not be sent again.

Condition for 180-day milestone:
AND(greaterOrEquals(outputs('Compose_DaysToExpiry'), 175),
lessOrEquals(outputs('Compose_DaysToExpiry'), 185),
not(contains(items('Apply_to_each')?['ReminderSentFlags'], '180')))

Expected Result

The condition evaluates to true only when the contract is within the milestone window AND the reminder has not already been sent.

6

If yes — Send email and update ReminderSentFlags

What

Send a reminder email to the ContractOwner and update the ReminderSentFlags field to record that this milestone has been sent.

Why

The email notifies the Contract Owner. Updating ReminderSentFlags prevents the same reminder being sent again tomorrow.

Send email:
To: items('Apply_to_each')?['ContractOwner/Email']
Subject: Contract Review Reminder — @{items('Apply_to_each')?['Title']} — 180 days to expiry
Body: [HTML email with contract details and review date]
Update item:
Site: Supplier & Contract Management
List: Contracts
Id: items('Apply_to_each')?['ID']
ReminderSentFlags: concat(items('Apply_to_each')?['ReminderSentFlags'], '|180')

Expected Result

The Contract Owner receives one reminder email for the 180-day milestone. The ReminderSentFlags field is updated to include '180'. The flow will not send this reminder again.

7

Repeat for 120, 90, 60, and 30-day milestones

What

Add parallel branches (or additional conditions) for each of the remaining milestones.

Why

Each milestone is independent. A contract may be in the 90-day window without having passed through the 120-day window if it was added to the system late.

Use the same pattern for each milestone, changing the window values and the flag string.

Expected Result

Each milestone sends exactly one reminder email, regardless of how many times the flow runs while the contract is within that window.

Testing the Duplicate Prevention

To test the duplicate prevention without waiting for the real dates, temporarily set a test contract's EndDate to today + 180 days. Run the flow manually. Verify the reminder email is sent and ReminderSentFlags = "180". Run the flow again. Verify no second email is sent. Then check ReminderSentFlags — it should still be "180", not "180|180".

Flow 2 — DToDLab012-RiskRatingCalc

DToDLab012-RiskRatingCalc

Trigger: When item created or modified (Risks)

Calculates the RiskRating from Likelihood × Impact and updates the Risks list.

1

Trigger: When an item is created or modified

What

Trigger on the Risks list whenever a record is created or modified.

Why

The RiskRating must be recalculated whenever Likelihood or Impact changes.

Site: Supplier & Contract Management
List: Risks

Expected Result

The flow triggers whenever a risk record is created or modified.

2

Compose — calculate RiskRating

What

Use a Switch expression to calculate the RiskRating from Likelihood and Impact.

Why

The risk matrix (Stage 5) defines the mapping. A Switch expression is cleaner than nested conditions.

Expression:
switch(
concat(triggerBody()?['Likelihood'], '-', triggerBody()?['Impact']),
'Low-Low', 'Low',
'Low-Medium', 'Low',
'Low-High', 'Medium',
'Medium-Low', 'Low',
'Medium-Medium', 'Medium',
'Medium-High', 'High',
'High-Low', 'Medium',
'High-Medium', 'High',
'High-High', 'Critical',
'Unknown'
)

Expected Result

The Compose action outputs the correct RiskRating string.

3

Update item — set RiskRating

What

Update the Risks list record with the calculated RiskRating.

Why

The RiskRating field in the Risks list must be updated so the Power App can display it.

Site: Supplier & Contract Management
List: Risks
Id: triggerBody()?['ID']
RiskRating: outputs('Compose_RiskRating')

Expected Result

The RiskRating field is updated in the Risks list. The Power App displays the correct rating.

Flow 3 — DToDLab012-OverdueActions

DToDLab012-OverdueActions

Scheduled — Daily 08:00

Sends daily reminders for overdue actions to the action owner.

1

Recurrence trigger

What

Trigger the flow every day at 08:00.

Why

Overdue actions should be flagged daily until they are completed.

Interval: 1
Frequency: Day
At: 08:00

Expected Result

The flow runs every day at 08:00.

2

Get items — Actions list

What

Get all actions where DueDate is before today and Status is not Complete.

Why

Only overdue, incomplete actions need reminders.

Filter Query: DueDate lt '@{utcNow()}' and Status ne 'Complete'

Expected Result

The action returns all overdue, incomplete actions.

3

Apply to each — send reminder email

What

For each overdue action, send a reminder email to the action owner.

Why

Each action owner must be notified individually.

To: items('Apply_to_each')?['Owner/Email']
Subject: Overdue Action — @{items('Apply_to_each')?['Title']}
Body: Your action '@{items('Apply_to_each')?['Title']}' was due on @{items('Apply_to_each')?['DueDate']} and is now overdue. Please update the status or completion date in the Supplier & Contract Management application.

Expected Result

Each action owner receives a daily reminder email for each overdue action.

Daily Reminders for Overdue Actions

Unlike the contract reminder flow, the overdue action reminder does not use a sent-flag. This is intentional — overdue actions should be flagged every day until they are completed. The action owner should be motivated to complete the action to stop receiving the reminders. If daily reminders are too frequent for your organisation, change the recurrence to weekly.

Stage Complete — What You Now Have

  • ✓DToDLab012-ContractReminder: daily flow, 5 milestones (180/120/90/60/30 days), duplicate prevention via ReminderSentFlags
  • ✓DToDLab012-RiskRatingCalc: triggered on risk create/modify, Switch expression for all 9 Likelihood × Impact combinations
  • ✓DToDLab012-OverdueActions: daily flow, sends reminders for all overdue incomplete actions
  • ✓Detailed explanation of the ReminderSentFlags duplicate prevention technique
  • ✓Note on illustrative reminder dates vs real contract management practice
NextSecure

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