Stage 9 of 17
In this stage you will build the Power Automate warranty alert flow. This flow runs every morning, checks the Equipment Register for items with warranty expiry within 30 days, and sends a single summary email to the IT team. This is the core automation that transforms the register from a passive record into a proactive management tool.
Why Are We Doing This?
Flow Name
DTOD-001 Warranty Alert
Business Purpose
Proactively notify the IT team of equipment with warranty expiry within 30 days, enabling action before warranties lapse.
Trigger
Scheduled — Recurrence (daily)
Run Time
08:00 UTC daily (09:00 BST / 08:00 GMT)
Alert Recipient
it-team@contoso.co.uk
Expected Outcome
Single email sent only on days when qualifying items exist. No email on days with no qualifying items.
The following documents every action in the flow in the order they appear. Read through the complete flow before building it — understanding the whole before building the parts prevents mistakes.
The flow starts automatically on a schedule. No manual trigger is needed.
Interval: 1
Frequency: Day
Start time: Set to a date in the past at 08:00:00 UTC (e.g. 2024-01-01T08:00:00Z)
Time zone: UTC
Retrieves all items from the Equipment Register list. No filter is applied here — filtering is done in the condition inside the loop. This ensures all records are checked, including those added after the flow was created.
Site Address: Select your SharePoint site from the dropdown (e.g. https://[tenant].sharepoint.com/sites/ITTeam)
List Name: Equipment Register
Top Count: Leave blank (retrieves all items, up to the default limit of 100)
⚠ Important: If your list may exceed 100 items, set Top Count to 5000 and enable pagination in the action settings.
Creates an empty array variable to collect the equipment items that meet the warranty alert criteria. This variable will be built up inside the loop and used to construct the email body.
Name: WarrantyItems
Type: Array
Value: Leave blank (empty array)
Iterates over every item returned by the Get items action. The body of this loop (steps 5 and 6) runs once for each equipment record.
Select an output from previous steps: value (from the Get items action)
Evaluates whether the current item meets all three criteria for a warranty alert. All three conditions must be true.
Condition 1 — Warranty Expiry Date is not blank:
empty(items('Apply_to_each')?['Warranty_Expiry_Date'])
Set this condition to: is equal to false
Condition 2 — Warranty Expiry Date is within 30 days:
items('Apply_to_each')?['Warranty_Expiry_Date']
is less than or equal to:
addDays(utcNow(), 30)
Condition 3 — Status is not Retired or Disposed:
items('Apply_to_each')?['Status']
is not equal to: Retired
AND is not equal to: Disposed
If the item meets all three criteria, its details are added to the WarrantyItems array. This action runs only in the Yes branch of the condition.
Name: WarrantyItems
Value: Use the expression editor to build a formatted string for each item:
concat('• ', items('Apply_to_each')?['Title'], ' (', items('Apply_to_each')?['Asset_ID'], ') — Assigned to: ', if(empty(items('Apply_to_each')?['Assigned_To']?['DisplayName']), 'Unassigned', items('Apply_to_each')?['Assigned_To']?['DisplayName']), ' — Expires: ', formatDateTime(items('Apply_to_each')?['Warranty_Expiry_Date'], 'dd/MM/yyyy'))
This expression creates a formatted line for each qualifying item, e.g.:
• Dell XPS 15 Laptop (ASSET-0001) — Assigned to: James Okafor — Expires: 01/09/2026
After the loop completes, checks whether the WarrantyItems array contains any items. If it does, an email is sent. If it does not, the flow ends without sending an email.
Expression:
length(variables('WarrantyItems'))
is greater than: 0
Sends the warranty alert email to the IT team mailbox. This action only runs when at least one qualifying item was found.
To: it-team@contoso.co.uk (replace with your IT team mailbox address)
Subject:
concat('⚠ Warranty Alert — ', length(variables('WarrantyItems')), ' item(s) expiring within 30 days')
Body:
concat('The following equipment items have warranty expiry dates within the next 30 days: ', join(variables('WarrantyItems'), ' '), ' Please review and take appropriate action before the warranty expires. This is an automated message from the Equipment Register.')
Importance: High
If no qualifying items were found, the flow ends cleanly with a 'Succeeded' status. No email is sent. This is the expected outcome on most days.
Status: Succeeded
Comment: No warranty alerts today.
Why Understand Expressions?
empty(items('Apply_to_each')?['Warranty_Expiry_Date'])
Purpose
Checks whether the Warranty Expiry Date field is blank for the current item.
Explanation
The empty() function returns true if the value is null, empty string, or empty array. The ?['field'] syntax safely accesses a field — if the field does not exist, it returns null rather than throwing an error. We check this equals false, meaning the field has a value.
addDays(utcNow(), 30)
Purpose
Calculates the date 30 days from today.
Explanation
utcNow() returns the current date and time in UTC. addDays() adds the specified number of days. The result is a date 30 days in the future. We compare the Warranty Expiry Date against this value — if the expiry date is before or equal to this date, the item qualifies.
formatDateTime(items('Apply_to_each')?['Warranty_Expiry_Date'], 'dd/MM/yyyy')
Purpose
Formats the Warranty Expiry Date as a readable UK date (e.g. 01/09/2026).
Explanation
Power Automate stores dates in ISO 8601 format (e.g. 2026-09-01T00:00:00Z). The formatDateTime() function converts this to a human-readable format. The format string 'dd/MM/yyyy' produces day/month/year in UK format.
if(empty(items('Apply_to_each')?['Assigned_To']?['DisplayName']), 'Unassigned', items('Apply_to_each')?['Assigned_To']?['DisplayName'])
Purpose
Returns the assigned person's display name, or "Unassigned" if the field is blank.
Explanation
The if() function takes three arguments: a condition, a value if true, and a value if false. Here, if the Assigned To field is empty, we return the string "Unassigned". Otherwise, we return the DisplayName property of the People field. The ?['DisplayName'] syntax accesses the display name from the People column object.
join(variables('WarrantyItems'), '\n')
Purpose
Joins all items in the WarrantyItems array into a single string, with each item on a new line.
Explanation
The join() function concatenates all elements of an array with a separator. Here, the separator is '\n' (a newline character). This converts the array of formatted item strings into a single block of text suitable for the email body.
length(variables('WarrantyItems'))
Purpose
Returns the number of items in the WarrantyItems array.
Explanation
The length() function returns the count of elements in an array. We use this in two places: in the condition to check whether any items were found (length > 0), and in the email subject to show how many items are expiring.
Navigate to make.powerautomate.com and sign in.
Select + Create from the left navigation.
Select Scheduled cloud flow.
Configure the schedule:
Flow name: DTOD-001 Warranty Alert
Starting: Today's date at 08:00:00
Repeat every: 1 Day
Select Create. The flow designer will open with the Recurrence trigger already added.
Select + New step.
Search for SharePoint and select the SharePoint connector.
Select the action Get items.
Configure:
Site Address: Select your SharePoint site from the dropdown
List Name: Equipment Register
Beginner Tip
Select + New step.
Search for Initialize variable and select it.
Configure:
Name: WarrantyItems
Type: Array
Value: Leave blank
Select + New step.
Search for Apply to each and select it.
In the "Select an output from previous steps" field, select value from the Get items action.
All subsequent steps (E, F) will be added inside this loop.
Inside the Apply to each loop, select Add an action.
Search for Condition and select it.
Add three conditions using Add row and set the relationship to And:
Condition 1 — Warranty date is not blank
Left side: Select Expression and enter: empty(items('Apply_to_each')?['Warranty_Expiry_Date'])
Operator: is equal to
Right side: Select Expression and enter: false
Condition 2 — Warranty expires within 30 days
Left side: Select Dynamic content → Warranty Expiry Date
Operator: is less than or equal to
Right side: Select Expression and enter: addDays(utcNow(), 30)
Condition 3 — Status is not Retired or Disposed
Left side: Select Dynamic content → Status
Operator: is not equal to
Right side: Type Retired
Add another row: Status is not equal to Disposed
In the Yes branch of the condition, select Add an action.
Search for Append to array variable and select it.
Name: WarrantyItems
Value: Select Expression and enter the full concat expression from Step 6 above.
Beginner Tip
After the Apply to each loop (outside it, not inside), select + New step.
Add a Condition.
Left side: Select Expression and enter: length(variables('WarrantyItems'))
Operator: is greater than
Right side: 0
In the Yes branch of the second condition, add a Send an email (V2) action from the Office 365 Outlook connector.
To: Your IT team mailbox address
Subject: Enter the concat expression from Step 8 above
Body: Enter the concat/join expression from Step 8 above
Importance: High
In the No branch, add a Terminate action.
Status: Succeeded
Comment: No warranty alerts today.
Select Save at the top of the flow designer. Wait for the save to complete — you will see a confirmation message.
Why Test Before Going Live?
Test Method 1 — Manual trigger
In the flow designer, select Test (top right). Choose Manually and select Test. The flow will run immediately using the current data in the Equipment Register.
Before testing, temporarily change the Warranty Expiry Date on one of your sample records to a date within the next 30 days (e.g. tomorrow's date). This ensures the flow has at least one qualifying item to find.
After the test, check your IT team mailbox for the alert email. Then restore the original warranty date.
Test Method 2 — Test with no qualifying items
Set all Warranty Expiry Dates to dates more than 30 days in the future (or leave them blank). Run the flow manually. Verify that no email is sent and the flow completes with "Succeeded" status via the Terminate action.
Power Automate keeps a history of every flow run. To inspect it:
Flow fails on "Get items" with "Access denied" error
Likely Cause
The account running the flow does not have permission to read the Equipment Register list.
Fix
Check that the account used to create the flow (the flow owner) has at least Read permission on the SharePoint site. Navigate to the SharePoint site → Settings → Site permissions and verify.
Flow runs but no email is sent, even when qualifying items exist
Likely Cause
The condition logic is incorrect, or the Warranty Expiry Date field name in the expression does not match the actual column internal name.
Fix
Open the run history and expand the Apply to each loop. Check the condition action — look at the inputs to see what values are being compared. The internal name of the Warranty Expiry Date column may be "Warranty_Expiry_Date" or "Warranty_x0020_Expiry_x0020_Date" depending on how it was created. Check the Get items output to find the exact field name.
Email is sent but the body shows blank values for some fields
Likely Cause
The field name in the concat expression does not match the actual internal column name.
Fix
In the run history, expand the Append to array variable action and look at the output. If a field shows as null or empty, the field name in the expression is wrong. Check the Get items output to find the correct internal name for each field.
Flow sends an email every day even when no items qualify
Likely Cause
The second condition (checking array length) is missing or incorrectly configured.
Fix
Check that the second condition is outside the Apply to each loop (not inside it). Verify that the expression length(variables('WarrantyItems')) is greater than 0 is correctly configured.
Flow fails with "The expression is invalid" error
Likely Cause
A syntax error in one of the expressions — mismatched quotes, brackets, or incorrect function names.
Fix
Open the failed action in the run history and look at the error message. It will usually indicate which expression failed. Return to the flow designer, find the action, and carefully check the expression for syntax errors.
After building and testing the flow, answer these questions:
Application Support View
Need more help with the concepts?
Visit DosToDigital for guides, templates, and deeper explanations.