1. Tasks
  2. Get Stub

Tasks

Get Stub

Retrieves a single stub by its stubref and/or a query. Useful for cross-stub lookups, reporting, related-process automation, and integration payloads.

Basic Usage

Task to retrieve a specific stub by its stubref.

loading...

Parameters

stubref
optional
string

The reference of the stub to retrieve: 1970-01-01-XXXX-1234

Required unless query is given. When both are given, the stub must match both.

query
optional
string | object

A MongoDB-formatted filter, as a JSON string or an object, used to find a stub: {"data.order_number": "123"}

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.

Required unless stubref is given.

sort
optional
string | object

Which stub to return when more than one matches, as a JSON string or an object of 1 (ascending) and -1 (descending) directions: {"createdAt": 1}

Default: {"updatedAt": -1, "stubref": -1} (the most recently updated stub)

fieldname
optional
string

The name of the field in the stub data to save the stub to: my_first_stub

Leave it out, or set it to false, to only return the stub in the task result without saving it to the stub.

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

  • Only stubs in the stub's own org can be retrieved.
  • If more than one stub matches, the first one by sort is returned.
  • The task fails if no stub matches.
  • This task cannot run on a dashboard enabled action.

Result

loading...

Properties

fieldname

The fieldname parameter given, if any: my_first_stub


stub

The stub data object retrieved. The projection parameter determines which fields are included in the results.