What I am trying to achieve is to fetch the 10 most recent items assigned to me. Where “recent” implies that the item has been created or updated recently.
I am current using this query:
boards (ids: [3576472011 3576476533]){
id
name
items_page (query_params: {rules: [{column_id: "person", compare_value: ["assigned_to_me"], operator: any_of}
]}, limit: 500) {
items {
id
created_at
updated_at
}
}
}
I fetch up to 500 items per board and then do the sort myself by querying the created_at and updated_at dates, is there a way to sort the items in the request so that I do not have to fetch 500 items and potentially miss out on 501-xxxx?
Not sure if created_at and updated_at are supported and how this would work on multiple boards. It does seem to work with the creation_log, but not sure if it compares the person or the date part of the creation_log.
updated_at and created_at seem to be fields that are added by Monday, so they aren’t columns on the board. However it does not allow you to use those fields to order_by.
The fields clearly exist as you can see it returns data in the first screen shot. However when you try use it, it gives an error saying that it does not exist.
Dear @Matias.Monday, I was trying to use order with cursor and got this kind of error.
"Invalid request: You must provide either a ‘query_params’ or a ‘cursor’, but not both. Use ‘query_params’ for the initial request and ‘cursor’ for paginated requests.
I have removed query_params to do the pagination via cursor. But it seems the responses aren’t ordered. How can we do ordered pagination?
In your initial query you can specify the order_by and return the cursor as an output field. As log as the cursor is not null you do a query like this:
query getItemValuesInBoard ($columnId: [String!], $cursor: String!) {
next_items_page (limit:100, cursor: $cursor) {
cursor
items {
id
name
column_values (ids: $columnId) {
id
value
text
... on DependencyValue {
id
value
linked_item_ids
}
}
}
}
}
The next_items_page query does not accept the order by as that was already specified in the initial query