Hello,
I have a problem with initializing variable. In flow I'm trying to achieve automate deletion of files which are older than 7 days. But variable is the last thing that is doing problems. I've looked at lot of forums but it is not working.
There is the variable:
greater(utcNow('yyyyMMdd'), formatDateTime(adddays(item()?['Created'],7),'yyyyMMdd'))
There is scheme of Flow:
Many thanks for any support!
Hi there. It looks like the expression in your variable is referencing something that hasn't happened yet (with the item() part).
Try initializing the variable like you have it, but leave the value blank.
Then after your Get file properties bit, add a "Set variable" action with that same expression. It may want to be inside of your Apply to each loop, not sure.
Also, check out using a Compose rather than the variable. It might work better for you, as well.
Keep us posted.
-Ed
If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.
Hi,
I've tried to do that as you said and it doesn't work. I guess there is problem in me, because I do not understand Flow very well 😄
Value in item() is blank.
Here I just deleted "7"
greater(utcNow('yyyyMMdd'), formatDateTime(adddays(item()?['Created'],'yyyyMMdd'))
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
30 | |
11 | |
10 | |
7 | |
5 |
User | Count |
---|---|
45 | |
22 | |
13 | |
13 | |
10 |