# Do While Loop is Breaking

**URL:** <https://forum.uipath.com/t/do-while-loop-is-breaking/473082>\
**Category:** Activities\
**Tags:** do-while, question, studio, system, webapi, activities\
**Created:** [September 14, 2022, 9:47pm UTC](https://forum.uipath.com/t/do-while-loop-is-breaking/473082 "2022-09-14T21:47:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jcircuit13](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jcircuit13/32/264601_2.png) [@Jcircuit13](https://forum.uipath.com/u/Jcircuit13)\
**Post date:** [September 14, 2022, 9:47pm UTC](https://forum.uipath.com/t/do-while-loop-is-breaking/473082/1 "2022-09-14T21:47:03Z")

</div>

Hi all,

For some reason my do while loop is breaking and exits the workflow after one iteration. The intention of the workflow is to check to see if a mailbox exists in exchange online via a API request. If the api request returns a 404 status then it should loop back through with a delay and check again until the response status is 200. However it just exits the workflow after one run even though the condition was not met in the do while.

I will in include the segment of the project I am having issues with. I have removed the bearer token from the HTTP Request activity as well as changed the endpoint URL for privacy reasons. I know the API request works and returns the proper information. I have only tested this with the 404 error and that is where im running into issues.

[DoWhileIssue.xaml](https://forum.uipath.com/uploads/short-url/tmlkmmztzb4SZ90PGhMhqY5xc5V.xaml) (21.6 KB)

---

<div class="post-metadata">

**Author:** ![postwick](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/postwick/32/227083_2.png) [@postwick](https://forum.uipath.com/u/postwick)\
**Post date:** [September 14, 2022, 10:06pm UTC](https://forum.uipath.com/t/do-while-loop-is-breaking/473082/2 "2022-09-14T22:06:15Z")

</div>

Do While executes until the condition IS NOT met. You have to switch your condition so it returns true until you want the Do While to exit.

---

<div class="post-metadata">

**Author:** ![Jcircuit13](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jcircuit13/32/264601_2.png) [@Jcircuit13](https://forum.uipath.com/u/Jcircuit13)\
**Post date:** [September 15, 2022, 12:44am UTC](https://forum.uipath.com/t/do-while-loop-is-breaking/473082/3 "2022-09-15T00:44:14Z")

</div>

Wow I guess it was a long day. I’m so sorry to waste your time but thank you.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [September 18, 2022, 12:44am UTC](https://forum.uipath.com/t/do-while-loop-is-breaking/473082/4 "2022-09-18T00:44:41Z")

</div>

Closed on September 18, 2022, 12:44am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
