Hello everyone,
I'm trying to build a flow with the following characteristics:
- when someone creates a new item in a sharepoint list, the flow is triggered (and it does stuff related to approvals, etc)
- inside the flow, I would like to have a Do Until loop that runs every 3 hours, to check if the item that triggered the flow still exists. If it doesn't the entire flow will be terminated.
The problem I have is that once the flow is launched, the Do Until only loops 1 time, and then it goes through to the next step as if the condition wouldn't work.
Here are the details of my flow:
I initialize a variable called item_exists and set it to false
Then onto the Do Until:
After the Do Until I have just a condition to end the flow :
After reading around I tried many different combinations for the condition of the Do Until. But here it goes:
1 - Condition: item_exists is not equal to bool(true)
2 - Delay for 3 hours
3 - Set item_exists to bool(false)
4 - Retrieve the item that triggered the flow by ID
5 - Apply to each of the result set from step 4 (should retrieve only 1 item)
5.1 - For the item that is returned (meaning that it exists) I set item_exists to bool(true)
So this should work like this:
Once the flow starts, it goes into the Do Until. After waiting for 3 hours, sets the var to false and
runs a get items to check if the sharepoint list item still exists:
- if it exists, the loop should continue to run (item_exists = true, doesn't meet the condition of not equal to true)
- if it doesn't exist, item_exists should remain as false, hence meeting the condition and ending the loop.
If the loop is ended, the next condition (if item_exists is equal to bool(true)) will not be met and terminate the flow run.
But this just doesn't work and I really don't know how else to make it work 😕
when the loop starts, it waits for 3 hours and then goes directly into the next step out of the loop.
Any help or comments will be really
appreciated.
Thanks !
Juan
Solved! Go to Solution.
Hi @juanmsue ,
According to your description of the flow demand, and the screenshots of your flow, your problem exists in that you do not judge the existence of item in do-until. You can configure your action according to my screenshot as below.
Add a condition to judge the existence of item that created in the beginning.
length(body('Get_items')?['value'])
If the length is not equals to 0, set variable item_exists to false.
Please have a try with them.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I'm not entirely clear on what you're trying to do here, but I'm guessing Flow is exiting the Do Until... loop after the first cycle because you're setting item_exists to False in one of the actions. Even though you set that variable back to True later on, the Do Until conditions have already been invalidated and the Do Until... loop exits after that first cycle.
There is a better way to check if an item exists than what you've implemented here. Basically, you'll still use Get Items, but then you'll evaulate the output of that action in a conditional. That way, you can adapt your Flow so that item_exists won't need to be set to False (ending your Do Until... loop) until the item truly doesn't exist.
Hi @juanmsue ,
According to your description of the flow demand, and the screenshots of your flow, your problem exists in that you do not judge the existence of item in do-until. You can configure your action according to my screenshot as below.
Add a condition to judge the existence of item that created in the beginning.
length(body('Get_items')?['value'])
If the length is not equals to 0, set variable item_exists to false.
Please have a try with them.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
65 | |
23 | |
16 | |
15 | |
11 |
User | Count |
---|---|
115 | |
35 | |
30 | |
28 | |
26 |