How to use: Run Flow

Hi everyone!

I need help to implement Run Flow in my capacitor app.

This flow I created to execute. When flow runs, User will get an alert.

image

This is button to trigger the flow run.

This is the generated code to run test_flow.

<button class="button" dmx-on:click="run({subflow:{name:'test',outputType:'text',flow:'test/test_flow'}})">Run flow</button> 

I don’t know where I’m doing wrong, this isn’t working.

A flow can be run on any dynamic event, so on button click directly run your flow, don't call another flow to run it.

Since I don’t want to directly use it in my page using app flow or page flow how can I run it?

Above is just an example.

I want to achieve this actually:

When user logs in > run flow load profile > run flow insert data to table1 > run flow insert data to table 2 > show success login alert.

I am not sure i understand what you mean here. What do you mean by "I don’t want to directly use it in my page"?
Are you using a page flow or an app flow?

These flows are neither in page flow nor in app flow. These are created in Workflows section.

I’ll share actual project structure to you in DM. Please check

Basically what you want: user logs in, gets directed to a page which loads their profile, then inserts data into table1, then inserts data to table2, then gives them a notification. This all takes place before the user has a chance to click on the page or navigate away.

You're complicating this. After the user logs in and gets directed to a page, use a server connect to load their profile (auto run). When that server connect is finished, use its dynamic event "on success" to trigger the insert data to table1 server connect. When table1 server connect is done, use its dynamic event "on success" to trigger another server connect for inserting into table2. When that is done, use "on success" again to show the alert/notification.

You can chain server connects together by using their dynamic event handlers and "on success". You don't need to use flows to accomplish this.

I simply want to know how to use Run Flow

You'll want to search and read the How-To's on App Flow and Page Flow. Those are the correct names. "Run" is just a command.

From what I gather, you are attempting to use:

<button dmx-on:click="run({subflow:{name:'test', outputType:'text', flow:'test/test_flow'}})">Run flow</button>

But run() is not how you execute a Server Flow. That syntax is only for running a subflow inside another flow, not for running a workflow from the client.

In Wappler:

1. Workflows (Server Flows) cannot be executed using run() from the front‑end.

run() is only for Flow Actions inside App Flows or Page Flows.

2. To run a Workflow from a page/app, you must use a Server Connect API Action.

Every Workflow automatically exposes an API endpoint.

3. The correct approach is:

  • Create a Server Connect Action pointing to the workflow.
  • Bind that action to your button.
  • Chain actions using onSuccess.