Lookup action to keep trying until user is found

Luiz Lucena
Mega Sage

Hello friends, 

 

I have this simple Flow to add user to Entra ID group. This runs after the new user account is created in AD (separate flow), we added to the new user creation a 22 minute timer to allow replication between multiple systems, DCs, cloud, etc.

However, sometimes, the account is not synced in time to Entra ID by the time this flow runs. The error message received is "Error: No user found."

We don't want that to be completed and skipped as error, because most of the time this action runs fine, but sometimes, the user doesn't get synced in one, two or even 5 minutes, so instead of adding additional timer, we would like to have the Flow try again in 1min until the user is found. 

But my question is, how should I make the Flow to go back to that action once the IF condition is matched?
Or should we add another Lookup action?

 

Screenshot 2025-09-30 at 14.29.16.png

 

Thanks in advance,

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You can create a Flow Variable, then add an Else to the If block to update the Flow Variable (if the user is found).  Put the look up and If inside a 'Do the following until' activity (while the Flow Variable is empty).

BradBowman_0-1759259068084.png

 

View solution in original post

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

You can create a Flow Variable, then add an Else to the If block to update the Flow Variable (if the user is found).  Put the look up and If inside a 'Do the following until' activity (while the Flow Variable is empty).

BradBowman_0-1759259068084.png

 

Thanks, @Brad Bowman  

Was just trying that, but then another question came up, in case of a user doesn't exist, we would like that "do this until user is found" to stop after, let's say 10 attempts, is that possible?

You could create another integer Flow Variable, then add an OR condition to your until...

BradBowman_0-1759260224000.png

Before or after waiting for 1 minute in the 'then' block, add a Set Flow Variables activity to increment the 'attempts' - a scripted condition something like this will work

return fd_data.flow_var.attempts++;

 

Thanks for the help, Brad!
That should work.

LuizLucena_0-1759261418885.png