Scheduling API Workflow with latest data?

Context:
I have a backend workflow that reschedules itself the following day at a specific time once it finishes. However, the workflow inputs for the next run are based on when the previous workflow finished.

Meaning, if there are new things that happen between the time that workflow finishes and when the next workflow starts, it won’t capture them.

Is there a way around this? Or am I building my workflow incorrectly?

You can always run a search in your workflow when it executes and use it in your actions.

Where would you put that search and in what action? Should it go at the beginning of the backend workflow?

You put the search in the action where you want to use the data.
I have no idea what you are doying in the workflow. :man_shrugging:

For example let’s say you have a list of users as input of your workflow and you use an action “modify a list of things” to add a flag on the users. Because you scheduled the workflow yesterday you have a list of users updated to yesterday’s data. You can modify your action to run on a new search for users instead of the input so you get an updated list.

Thanks for taking the time responding here…I’ll add some more context.

I have an initial trigger in my admin area that schedules an API workflow for current date/time.

The params I’m using at user, index, count

The backend workflow steps are as follows:

  1. Create a new thing (job) with 2 fields (worker = user:item #index, date = current date rounded down to day
  2. Set a things slug
  3. Recursive job creation
    image
  4. Schedules another API workflow (#2)
    image

Workflow 2:
1: Adds a list of creators to the inital thing from the previous workflow
image
2. If the job is < than the count of jobs and there are still creators to be assigned, it continues
image
3. If the job is >= to the count and there are still creators to be added, it resets the job count to 1 and goes back again to step 1
image
4. If the job is >= to the count and there are no more creators to be added, it schedules the workflow for the following day.
image

This is where it gets tricky and I can’t find a solution. I don’t know where to put the search that you suggested.

My understanding is this: in your last action you schedule a workflow for tomorrow and you set as inputs a list of user, an index, the count of another search. Your problem is that tomorrow that list of user will not be updated with the current situation of the db.
What you can try is: do a new search anywhere you would use the input search.
If you use the input in multiple actions then just create a custom event with the same input type, move your logic inside the custom event so you can reference the inputs there, from your main workflow trigger the custom event do a new search as input.

I tried to do this by updating all of the inputs, but it didn’t fully work as intended.

What do you mean by inserting a new custom event?

https://manual.bubble.io/core-resources/actions/custom#custom-event-1

There may be multiple reasons why it does not work: order of exececuton (see here) or maybe something that you create/modify in a workflow it’s not synched with the search of the next workflow.

This topic was automatically closed after 70 days. New replies are no longer allowed.