Sep 16 2024 08:10 AM - edited Sep 16 2024 11:07 PM
I'm creating a training tracker as a SharePoint list. Within the list I have a date column for when a course is going to require a refresher, which is a calculated column based of Date of Training + Refresher period.
If I set up a choice column with the following options - In Date, Expiring and Expired, how can I achieve the following:
When a refresher date is 30 days away the status changes to 'Expiring'
Add a New Step > Get Items from SharePoint.
Do not apply any filter here — you will handle this in the flow.
We will initialize variables to store the dates in dd-MM-yyyy format for comparison with the RefresherDate.
formatDateTime(utcNow(), 'dd-MM-yyyy')
formatDateTime(addDays(utcNow(), 30), 'dd-MM-yyyy')
Before comparing the dates, ensure that the RefresherDate is not null.
Now we will add a condition to check if the RefresherDate is between today and 30 days from today.
Inside the If Yes branch (after checking for null), add a New Condition to compare the RefresherDate to today's date and 30 days from today.
Condition 1 (Check if RefresherDate is less than or equal to 30 days from today):
formatDateTime(items('Apply_to_each')?['RefresherDate'], 'dd-MM-yyyy')
AND
Condition 2 (Check if RefresherDate is greater than or equal to today):
formatDateTime(items('Apply_to_each')?['RefresherDate'], 'dd-MM-yyyy')
This ensures that the RefresherDate is between today and 30 days away, in dd-MM-yyyy format.
In the If Yes branch (if the RefresherDate is within the range), add an Update Item action to update the status.
Sep 21 2024 03:05 AM
@dbrown2275 you've said the flow is failing but not said what the error message is so it doesn't help us. Also, when doing date comparisons it is usually better to use yyyy-MM-ddd format (whatever your normal date format is).
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)