Page Flow (in-page)
Page Flow executes inside a page, can interact with that page’s components/actions, and can return data.
Page Flow (in-page): what it is
Page Flow is a client-side workflow that executes inside a specific page. It can interact with that page’s components/actions and can return data.
TIP: Use a Page Flow when the workflow belongs to one page and needs to interact with that page’s components/actions.
Define a Page Flow (inline HJSON)
A Page Flow lives inside the page as a dmx-flow script block. It can branch and execute steps sequentially.
<!-- Define a Page Flow directly in the page -->
<script is="dmx-flow" id="confirm_delete_flow" type="text/dmx-flow">{
bootbox.confirm: {
message: "Are you sure you want to delete this item?",
then: {
steps: [
{ toast.show: {message: "Deleting item..."} },
{ delete_api.send: {id: "$param.id", output: true} },
{ items_list.load: {} },
{ toast.show: {message: "Item deleted"} }
]
},
else: {
steps: { toast.show: {message: "Cancelled"} }
}
}
}</script>
Run it and use results
Run the flow from an App Connect event, then read flowId.data, flowId.running, and flowId.lastError in your UI.
<!-- Run the Page Flow from an event --> <button class="btn btn-danger" dmx-on:click="confirm_delete_flow.run({ id: item.id })">Delete</button><!— Use status + results —> <div dmx-show=“confirm_delete_flow.running”>Processing…</div>
<div class=“alert alert-success” dmx-if=“confirm_delete_flow.data && confirm_delete_flow.data.success”> <span dmx-text=“confirm_delete_flow.data.message”></span> </div>
<div class=“alert alert-danger” dmx-if=“confirm_delete_flow.lastError”> <span dmx-text=“confirm_delete_flow.lastError.message”></span> </div>
Wrap-up
Review what you did and choose a next tour.
Next steps
Pick a related tour to continue.