Trigger workflow/production line after saving changes of a table

Dear community,

we want to edit a data table and save the changes. Thereupon, we want to trigger a workflow that creates (based on that data) an aggregated table.

We save the changes via a microservice (config.editing.saveToMicroservice). After that we want to trigger the second workflow. Any ideas how I could first trigger the microservice, save the changes, and then trigger the workflow?

(We already thought about using config.editing.saveToFunction and use the function to trigger a WF/PL but then we can’t use the built-in functionality to save data table changes)

In the workflow where you save a table from the app via ā€˜saveToMicroservice’, you could trigger a WF via Flexible REST API Processor (POST with endpoint ā€˜workflows/{wf_id}/jobs?target-project={project_id}’), which loads the data set saved in the first WF and performs further transformations.

1 Like

That was the other idea we also had in mind :slight_smile: Do you have a suggestion how I could ensure that the data table is saved first before the second WF is triggered via the REST API?

You could put both workflows into the same isolation group to make sure that the second workflow waits until the first one has finished. But I’m not exactly sure if this could cause some kind of deadlock if the REST API Processor waits for the response that the second workflow has started and the second workflow waits for the first workflow to finish (but I would guess it is not the case)

1 Like

There is also a new feature in development called ā€œevent-based schedulerā€ that allows you to trigger workflows from changes on a datatable.
Depending on how soon you need to solve your challenge, this might be an option

1 Like

One more option (I am not sure if you’ve thought about that in your ā€œfunction ideaā€) would be to use saveToFunction and just save the datatable changes there via the API (there is a nice SDK function for that by now) and call the workflow(s) or production line(s) afterwards :slight_smile:

1 Like

Thanks for your ideas!

We are currently testing the approach with the REST API call and isolation groups (we are just having some issues with the API in general so that i can’t tell you yet whether it worked).

We will take the ā€œevent-based schedulerā€ feature into our backlog so that we can apply it when it is available, that is a very clean solution :slight_smile:

thank you for that hint! We will test that if the REST API and isolation groups approach we already implemented will not work :slight_smile:

The solution with the REST API call and isolation groups works for us, thanks for the help! :slight_smile: