Hello everyone,
I'm fairly new to Power Automate, and Power Platform in general, so I apologize in advance if my question may be too obvious or something similar.
Currently, I'm trying to implement some sort of a lifecycle management solution for SharePoint Online sites. Before anyone suggests it, yes, I know about Microsoft Syntex. Unfortunately, it's a paid feature, and we have tons of users in my org and licensing all of them would simply be too much. That's why I've started researching options for doing this through Power Automate.
Basically, I want to have a list that contains following columns:
- SiteName
- SiteURL
- RetentionDays
- RemainingDays
- MarkedforDeletion (choice field with options "Yes", "No" and "PendingApproval")
- DeletedOn
- Approver (person field)
This list would be used by my flow to connect to and, based on retention and remaining days, it would either send an email to the approver (if remaining days = 0) or simply decrement retention days (if remaining days /= 0). Based on the approver decision, it would further mark the site for deletion by changing the choice in MarkedforDeletion column if approver approves the email, or if approver rejects it, simply reset the remaining days to the value of retention days. Here's how the list looks:
So far, my flow looks like this:
It's a scheduled flow set to run once per day.
By using the Get Items, it connects to the SharePoint Online site that stores my list.
After that, it's coming to a condition that checks the RemainingDays column.
If the column value is equal to 0, it should, using Update Item, change the MarkedforDeletion column to "PendingApproval".
If the column value is not equal to 0, it should, again using Update Item, decrement the number of remaining days by subtracting 1 day from the value of retention days (for example, if retention days is set to 10, it should be 10-1), and set the MarkedforDeletion column to "No".
I haven't even gotten to the "If no", part of the condition and I'm already stuck.
I manually set the value of remaining days field to 0 to see if the flow will change the MarkedforDeletion column to "PendingApproval", and I'm receiving this error:
Flow does run successfully, but it doesn't update my MarkedforDeletion column. It just fallbacks to the "If no" option.
Bonus question is this: I haven't gotten to the point to set any logic behind decrementing the number of days if the RemainingDays value is not 0, and to be honest, I don't really know how I would to that. I tried using the sub() function, but as far as I know, I can only provide number values there and my idea requires something a bit more complex. It would need to subtract 1 day each day from the value of RetentionDays.
If any further clarification or info is needed, let me know.
So, if anyone can assist me on this, or point me in the right direction, I would highly appreciate it.
Thanks in advance!

Report
All responses (
Answers (