How to filter, sort, search, and paginate through your engagements
The engagements query provides a powerful way to list and search through all of your
engagements. It supports filtering, text search, sorting, and cursor-based pagination.
To retrieve a simple paginated list of engagements, use the first argument to specify
how many results you want:
query ListEngagements { engagements(first: 10) { edges { cursor node { ... on PurchaseEngagement { id shortId type closingDate owner status { state } } ... on RefinanceEngagement { id shortId type closingDate owner status { state } } } } pageInfo { hasNextPage endCursor } }}
Use the query parameter to perform a text search across engagements. This is useful
for finding engagements by client name, short ID, or other searchable fields:
query SearchEngagements { engagements(first: 10, query: "Jane Doe") { edges { node { ... on PurchaseEngagement { id shortId clients { firstName lastName } } ... on RefinanceEngagement { id shortId clients { firstName lastName } } } } }}
The query and filters parameters can be combined to perform a text search
within a filtered set of results.
The engagements query uses cursor-based pagination. Use pageInfo to determine if
there are more results, and pass the endCursor value as the after argument to
fetch the next page:
query NextPage { engagements(first: 10, after: "eyJpZCI6MTB9") { edges { cursor node { ... on PurchaseEngagement { id shortId } ... on RefinanceEngagement { id shortId } } } pageInfo { hasNextPage endCursor } }}
A typical pagination loop:
1
Fetch the first page
Call engagements(first: 20) without an after cursor.
2
Check for more results
If pageInfo.hasNextPage is true, there are more results to fetch.
3
Fetch subsequent pages
Pass pageInfo.endCursor as the after argument in the next request.
Repeat until hasNextPage is false.
For more details on cursor-based pagination patterns, see the
Pagination documentation.