Get current iteration/index of API workflow on a list

I’m wondering if anyone has any clever tricks to get the current iteration of an API workflow on a list. I know I could do this with a recursive workflow but I would really rather not convert to one.

I am schedule the API workflow on a list of things in a table in my db and I want to populate a field called “counter”. If there are 10 things in my table, the counter values should be 1 for the first thing in the list and 10 for the last.

I know I could do this with “Do a search for…” and then do a :count + 1 but my list has 1000’s of things and I’m running this every day and I don’t want to do 1000’s of extra searches every day just to populate this field.

So, hopefully there’s a clever trick out there?

1 Like

if you figure it out let us know please

@cristian-zamfir I solved this with the server script action with this code:
image
And then the current index is the “result of step 1’s result”:
image

1 Like