0

Get Items By Column Value

by
Published Oct 9, 2023

Searches a column for items matching a value.

Script monday Verified

The script

Submitted by hugo697 Bun
Verified 399 days ago
1
import monday from "monday-sdk-js";
2

3
type Monday = {
4
  token: string;
5
};
6

7
export async function main(
8
  auth: Monday,
9
  boardId: number,
10
  columnId: string,
11
  columnValue: string
12
) {
13
  const mondayClient = monday();
14
  mondayClient.setToken(auth.token);
15

16
  const query = `query ($boardId: Int!, $columnId: String!, $columnValue: String!) {
17
    items_by_column_values (board_id: $boardId, column_id: $columnId, column_value: $columnValue) {
18
      id
19
      name
20
    }
21
  }`;
22

23
  const variables = { boardId, columnId, columnValue };
24

25
  return await mondayClient.api(query, { variables });
26
}
27