On this page
Record helpers reference
Look up post, user, page and permission helpers.
Before you begin: Requests and resources reference.
Rule Resource Helpers
These helpers are available inside FRL expressions and executable blocks.
| Helper | Purpose |
|---|---|
posts.findOne(args) | Read one visible post that matches the given filters. |
posts.findAll(args) | Read visible posts that match the given filters. |
posts.count(args) | Count visible posts that match the given filters. |
post.createAsActor(type, data) | Queue a related post create owned by the signed-in actor. It fails if there is no signed-in actor. |
post.createAsUser(type, data) | In a user lifecycle hook, queue a related post owned by the user being created, edited, deleted, or signed in. |
post.createAsSystem(type, data) | Queue a related post create owned by the system for automatic work such as logs, callbacks, and imports. |
post.edit(id, data) | Update the supplied fields on a related post by its generated ID. Omitted fields are preserved; supplied objects and arrays replace that field. |
post.delete(id) | Queue a related post delete by generated post id. |
post.increment(id, data) | Atomically increment top-level number or money fields on a post and refresh generated post indexes. |
chargeUser(args) | Request wallet confirmation before continuing a paid rule action. |
Every post.* target must be a declared post type. Related creates and edits require a declared schema and are checked against it before they are saved. Increments also require a declared schema and are checked against the target schema after the increment is applied. Deletes only require the target post type to be declared, because no new data is being saved. Related writes skip the target post type's before, after, and allow rules because the current rule has already accepted the action.
One rule run can queue up to 128 related writes. post.increment(id, data) accepts only top-level numeric fields, which keeps counters and balances clear.
posts.findOne, posts.findAll, and posts.count read posts that are available to the current rule run. Rule code can use the stored data it reads to decide what happens next. If an endpoint returns helper-read data, return only the fields the browser should see.
Query helper shape:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Helper query notes:
| Option | Notes |
|---|---|
type | Required for post helpers. It must name a declared post type. |
where | Object of field checks. Supported operators include gt, gte, lt, lte, in, between, contains, and includes. Money fields also accept { currency, amount } equality or { currency, gt/gte/lt/lte/ne }. |
AND, OR, NOT | Group where objects for compound checks. |
fields | Reference paths to expand, such as product.category.name. |
orderBy | Sort object. Use "asc" or "desc" values. |
limit | Defaults to 20 for findAll and cannot exceed 500. |
offset | Supported for small admin-style reads and capped at 10000. Prefer cursors for growing data. |
where.in accepts up to 50 values.
Money filters always name the currency being compared:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Money comparisons use exact fixed-scale decimal arithmetic and compare only entries with the requested currency. Do not compare or aggregate amounts from different currencies in one expression.
When a rule reads a post and needs referenced details, include the reference paths in fields:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Continue with Payment events and money reference.