Retool Workflows

Hi Retoolers,

I have just started using Retool Workflows and have successfully deployed my first workflow on a scheduled trigger. I have an app where I want to reference the result of the workflow in a table.

Flow:
Everyday the query runs at 3pm
Users should be able to check the app daily after 3pm to see refreshed data.

I tried using the resource Retool Workflow and selecting the workflow but I got no results.

How can I reference that result set in my table in my app itself?

Hey @AccoladeRetool -- if I understand correctly, the workflow is responsible for populating the table you need to show to users.

If that is the case, then you should be able to just use a table in your App and make the data source the response of a query that gets all of the refreshed data from where the workflow populated it.

Overall, you'd have:
3pm: Workflow run populates/modifies yourBackendTable
User: Opens app and latest data is displayed using a query that selects all from yourBackendTable

HI @pyrrho thanks for your prompt response. The workflow is just querying an existing database table, but its not populating data to another table, just refreshing an existing table, is there a way to just reference the query the workflow is running in app? Maybe my understanding of how workflows may be misguided as well.

I would suggest just running the query in your app then and not having a workflow at all.

You can setup the query in the app to run automatically when the page loads and then use that as the data source for the table. There should be a built in refresh button on the OOTB table to refresh the query and regenerate the table data.

ETA: I will say that you can use a workflow in your app to accomplish this as well (for the future). In this case, you could setup a connection to the workflow in the App and then in the workflow use a response node to send data back to the App which you would use as your table data.

Thanks for your help @pyrrho do you have an example of doing what you described in your ETA section? I am just still wrapping my head around how this all works.

Absolutely!

I just slightly modified the "new Workflow" default code to enable a webhook and provide the response in the form of the example code block:

In an app, you would then create a workflow import query and set the behavior to run automatically:

And then here's the query response being used as the table data:

image

1 Like

Hi @pyrrho thanks for those steps,, really appreciate it. I went ahead and tried those steps but got no results but I feel like something may be missing on my end.
Screenshot of the Workflow:


Screenshot of the app:

I didn't see an option for run behavior in my resource as well.
It also looks like I get an error saying Referenced block is not connected. It doesn't seem to want to connect when i try to connect them, I just get a red X on the connection line.
image

A couple of things:

  1. That block needs to be connected -- I'm not sure what the red X you are describing is (unless it is the X that shows up on the line when you hover over it to break the connection). Can you show a screen shot of what it looks like when you get the red X?

  2. The run behavior option seems to be hidden behind your "Output" drawer. To the right of the tab that says Output is a double down chevron that you can click to collapse the Output.

ok so it looks like it is running now and I can get results in my app so I am not sure what happened but the x is still there, but when I run it I see the log shows success(which I wasnt getting before)
image

1 Like

That X looks like the one that deletes the line. Maybe just refreshing the page will clear it up.

In any case, glad the workflow -> app response is working for you!

I think we are good now. Thanks for all the help!

2 Likes