Composing a Dataflow
To create and compose a new dataflow, perform the following:
- Navigate to the Neo extension portal [{host url}/extensions/neo/ui]() and select the organization in which you want to create the dataflow.
- Click Create new dataflow and enter a name for the dataflow in the Name field.
- (Optional) Create or assign a tag for the dataflow.
- Click Done.
The dataflow is created on the Dataflows page under the My Dataflows tab. - On the Dataflows page, click the dataflow.
The dataflow version page opens, showing the dataflow as versionv1
inDraft
status. - Click on version
v1
of the dataflow.
The Neo UI canvas opens with the Trigger and Schema block. - Add blocks to the dataflow as required by clicking a node. To reuse common logic, use the Helper Function block and invoke using the
dao.executeBlock()
function.
Note: Blocks do not follow a fixed sequence; arrange them logically based on requirements. - Click Save.
- Test the dataflow using an API testing tool.
- Click Send for Approval to submit the dataflow for approval.
The dataflow status changes toAwaiting approval
.

Composing a dataflow
Executing script block with reusable logic
You can run a script block with reusable logic ( helper function block ) using the dao.executeBlock()
function. This function calls a Script block from the block library and passes input arguments to it. The called block processes the input and returns a response.
Steps to execute a helper function block
-
Create and publish the helper function block in the block library.
-
In your main Script or Schema block, import
dao
from"neo/dao"
. -
Use
dao.executeBlock()
to run the helper block:- Pass the helper block name as the first argument.
- Pass input arguments as additional parameters.
- Use the
await
keyword to wait for the block's response.
Example:
const validationResult = await dao.executeBlock("validateMobileNumber", mobile);
validateMobileNumber
is the name of the helper block.mobile
is the input value.validationResult
stores the response returned by the helper block.
Example scenario
Requirement
During a dataflow execution, you need to:
- Validate a mobile number.
- Calculate the total amount, including tax.
Script block using executeBlock
executeBlock
import dao from "neo/dao";
import logger from "neo/logger";
const script = {
execute: async () => {
const mobile = "+1234567890";
const amount = 100;
const tax = 18;
// Call the mobile number validation helper block
const validationResult = await dao.executeBlock("validateMobileNumber", mobile);
if (!validationResult.isValid) {
return { error: "Invalid mobile number" };
}
// Call the tax calculation helper block
const totalAmountResult = await dao.executeBlock("calculateTotalAmount", amount, tax);
return {
validatedMobile: validationResult.cleanedNumber,
totalAmount: totalAmountResult.amountWithTax
};
}
};
export {
script as default
};
What this script does
-
Create and publish helper blocks
The blocksvalidateMobileNumber
andcalculateTotalAmount
are saved to the block library. -
Import
dao
The main Script block importsdao
to access DAO functions likeexecuteBlock()
. -
Call
executeBlock()
with block name and arguments- Pass
"validateMobileNumber"
andmobile
to validate the number. - Pass
"calculateTotalAmount"
along withamount
andtax
to compute the total.
- Pass
-
Use
await
to get the result
Theawait
keyword pauses execution until the helper block returns a response. This ensures that you work with the actual result.
Best Practices
- Include only the required blocks in your dataflow to improve performance.
- Use clear, descriptive block names that reflect the block’s purpose.
- Document the expected arguments and their order for each block.
- Validate all input arguments inside the block using
getFunctionArguments()
. - Always use the JavaScript keyword
await
withexecuteBlock
to ensure proper execution flow.
Limitations
- Only blocks included in the current dataflow's block library can be executed.
- Execution is asynchronous and must be awaited.
- Each block defines its response format; there is no standard structure.
- Arguments must be accessed by index, not by name.
- Blocks must be explicitly added to the dataflow to be executable.
Updated 19 days ago