While dwelling in my thoughts, a memory came to my mind. In my college time, I was present a challenge to make a recursive Fibonacci algorithm, in LISP without using Loops.
This was a challenge, because as you may know…
(these are probably my favorite programming comics)
But this gave me the idea of testing this concept in Logic Apps.
I’ve built a fairly simple LA just to test and with minimal inputs.
Before I could add the recursive connection to the Logic App, I had to deploy it first, because you can only call a LA or a Function if it’s already provisioned.
So, I’ve added the action after deployment, saved and tried to deploy again, and this came up:
This means that Logic Apps, by default, do not support recursive calls.
But I’m stubborn and I don’t give up easily. So, what would be the best way to call a LA knowing that I’d have to treat it like an external API?…
The answer is super simple. HTTP action!
We already have the URL, because we deployed it before, so there’s nothing stopping us from doing this.
No objections this time, so let’s test!
TA-DAAA! How easy was that? In my case, I’ve used a simple counter to add and loop, but you can use any other condition to recursively loop through your logic, for example until a SQL record is updated.
You can add delays to ensure that you won’t be making calls every second, or delay until a specific time. The possibilities are endless.