Tasks
Get Stubs
Retrieves the stubs matching a query, most recently updated first, up to a limit. Useful for reporting, bulk workflows, dashboards, and cross-process data aggregation.
Basic Usage
Task to find the 20 most recently updated stubs with "VIP" in the subject.
Parameters
query required string | object
A MongoDB-formatted filter, as a JSON string or an object, used to find matching stubs: {"subject": {"$regex": "vip", "$options": "i"}}
Use a JSON string when the query uses $ operators, such as $regex or $in, so they are kept intact.
The query can only narrow down the stubs of the stub's own org. It cannot be used to match stubs in other orgs.
sort optional string | object
The order to return the stubs in, as a JSON string or an object of 1 (ascending) and -1 (descending) directions: {"createdAt": 1}
Default: {"updatedAt": -1, "stubref": -1} (most recently updated first)
limit optional number
The maximum number of stubs to return, between 1 and 500.
Default: 50
fieldname optional string
The name of the field in the stub data to save the stubs to: VIP_stubs
Leave it out, or set it to false, to only return the stubs in the task result without saving them to the stub.
Results larger than 1 MB are not saved. Narrow the projection or lower the limit.
projection optional string | object
A MongoDB-formatted projection, as a JSON string or an object, used to specify which stub fields to return.
Default: {"stubref": 1, "subject": 1}
Notes
- Stubs are returned most recently updated first, unless sort is given.
- Only stubs in the stub's own org can be retrieved.
- The task fails if no stubs match.
- This task cannot run on a dashboard enabled action.
Result
Properties
fieldname
The fieldname parameter given, if any: VIP_stubs
stubs
An array of the stubs retrieved, in sort order. The projection parameter determines which fields are included in the results.
has_more
true when more stubs matched than the limit allowed, false otherwise.