How to check for condition and re-run a step

Looking to implement a repeatable loop if a condition is met. Basically my use case is:

  1. Create a job - via rest POST request
  2. Check for job status via rest GET request
  3. If job status = pending, pause for 1 second, re-run step 2
  4. Else, continue workflow.

Any suggestions on how to implement this? This is what I have so far:

What appears to happen is the second time we run “PDF” it doesn’t pass the correct JOB id from the previous step.

Where does the Job-ID come from? If it comes from node “AddJob” or any before that will be the problem as expressions always reference values from the same “run”. Meaning the first time all nodes execute they are all on “run” 1. So it works. The second time PDF executes, this node is on “run” 2 and it tries to get data of “run” 2 of the node “AddJob”. That node did however only run once, so the value can not be got and it fails.
So for it to work, you have to make sure that the Job-ID is in the loop. You could, for example, add a NoOp-Node between AddJob and PDF and pass the Job-Id as data through all the nodes in the loop. Then you can reference the Job-ID from the NoOp-Node and it should work fine.

Hope that makes sense.

Yep - the job id comes from the AddJob step.

I’ll play around with that. I’m not sure what you mean though - to get the JobID into the loop. Like No-Op doesn’t seem to reference any data, right?

I think I see what you mean. Use No-Op to cache the ID since it just takes the data and forwards it. Then loop back to No-Op.

Yes exactly. Just that you have something to reference which has the same “run”.

Okay cool. I got the ID cached now - seems to work like this:

But now the error is that I’m missing an Authorization header (which also gets aquired in another step prior to this).

Okay so I have this sort of working, (the loop works anyways). Now I’m trying to find a way to pause for a couple seconds in between loops. Is this possible?

Edit: Found it here:

Perfect, great to hear!