The blocks
Map Items
Keep only the fields you name, under the names you want. The biggest lever on payload size.
Filter Items
Keep only the items matching a condition, with an optional second condition.
Group & Aggregate
Collapse many rows into one item per group — count them, total them, merge their values.
Unique Items
Remove repeats, keeping the first of each.
Sort Items
Order a list by a field, ascending or descending.
Take Items
Take the first N items, optionally after skipping some.
Build Array
Create a list from scratch, or append to one you already have.
Parse JSON
Turn JSON text into a list you can map, filter and group.
To JSON Text
Turn a list back into JSON text for a response or message body.
Run JavaScript
A short script, for anything the blocks above cannot express.
customer.city reads the city inside customer.
Map Items
Give it a Field mapping: a JSON object of the name you want on the left, the field it comes from on the right.Filter Items
Pick a Field, a Condition and a Value. Available conditions: equals, does not equal, contains, does not contain, starts with, ends with, greater than, greater than or equal, less than, less than or equal, is empty, is not empty, is one of, is not one of. The last two take a comma-separated list. Add a Second field to test two things at once, combined with AND (both must match) or OR (either may match).Comparisons like greater than compare numbers as numbers when both sides look numeric, so
10 is correctly greater than 9. You do not have to declare a column type.Group & Aggregate
This is the block for turning a repeated export into one row per thing. A schedule with one row per doctor per day becomes one row per doctor. Set Group by to the field (or comma-separated fields) that identify a group, then list what each group should contain in Aggregations:count needs a
field.
Include group fields carries the group-by fields onto each result item. Leave it on unless you
have a reason not to.
If you leave Aggregations empty and turn Include group fields off, there is nothing to
put in each group. The step will tell you rather than quietly returning empty items.
Filter before you group
Rows that should not count must be removed before grouping. In a staff schedule, a day someone is off is still a row, and it still carries a location — group without filtering and you will credit people with places they never work.1
Filter Items
Time Start does not equal Off2
Group & Aggregate
Group by
Doctor Name, merging Location with join_distinct3
Map Items
Keep just the fields the answer needs
4
To JSON Text
Compact, into the response body
Run JavaScript
For a transform the other blocks cannot express. Prefer a regular block where one fits — those show their inputs and outputs in the run history, while a script is opaque when something goes wrong.- Read an earlier step with
getOutputFrom('<step id>', '<Output>'). The Use a previous step picker adds the reference to the end of your script. - Rows behave like objects:
r['Doctor Name']andr.Departmentboth work. - End with a plain expression —
out;— because the result is the value of the last expression. A script that ends with a loop returns that loop’s last value instead, which is rarely what you meant.
Scripts run in a sandbox. They cannot reach the server, the filesystem or the network, and they are
limited in how long they may run and how much memory they may use — a script that never finishes
fails its step instead of holding up anything else.
Feeding an AI agent tool
When a flow answers an AI agent tool, what the agent receives is capped at 24,576 characters. Beyond that the response is cut short, and the agent is told it is incomplete so it can ask again more narrowly — but a shortened answer is still a worse answer. The fix is to send less, not to send more:Send only what is needed
Map Items to a handful of fields. Dropping the columns a question never asks about is the
single biggest saving.
Split by question
One tool returning a directory, another taking filters and returning detail, beats one tool
trying to return everything.
Stay compact
Leave Indented off in To JSON Text — formatting is wasted space for a machine reader.
Watch the size
To JSON Text reports Length, so you can branch when a payload grows.
Next steps
Building a flow
The canvas, the palette, connecting steps and publishing.
Runs and troubleshooting
See what a step actually produced when a flow misbehaves.

