Query by connect boards column (board_relation) using id instead of name

Hi, I’m using the query documented here to get items from a board that has a specific board_relation to another one.

The following query:

query_params: {rules: [{column_id: \"connect_boards\", compare_value: [\"test123\"], operator:contains_text}]}

will try to get items by item name (i.e. items named “test123”). The problem is that this value is not unique and can be easily changed on the frontend. How can I get this same relation, but using the item id as the parameter?

Hi Leonardo,

Welcome to the community!

If you are looking to query items from a specific board, you can use items_page , documented here, as now being used in version 2023-10 and onward.

Hope this helps with your request!

Best,
Joseph

Hi Joseph, thanks for the response. I’ve already solved my problem creating an external id field to link the two boards; but what I meant is, for instance:
Imagine there are two boards, “business” and “contacts”. A business can have one or multiple contacts. If I want to get the businesses that are associated with a certain contact, I need to query the “business” board using the contact’s “item_name” (at least that’s how it works based on my quick tests). Can I use another field instead of the item_name? For instance, its id, or any other field?

1 Like

Hi Leonardo,

From my understanding, in this scenario, a single contact will be a single item on the Contacts board and there is a different board, Business, that has a connected column to Contacts. If this is the case that there is a connect column, then you can query via the connect boards column, documented here.

Does this help clarify your request?

Best,
Joseph

1 Like

Scenario:

Board A has a connect board column to Board B. Now we have a webhook on board B to tell us a column changed. We need to know what items on Board A are linked to that item on Board B.

There is only a one-way connection involved, so items on Board A are connected to Board B.

When the webhook triggers, we need to find items on Board A that are connected to Board B. We currently cannot do this because items_page querying a Connect Board column only searches based on text, to see if one of the items has the name we are searching for. But the name is not unique!

board_relation columns need to be enhanced for ItemsQueryRule to have compare_attribute of “linked_item_id” and “linked_item_name” so we can compare either the item name or the item ID with items_page.

Same with mirror columns and dependency columns. This way we can easily perform reverse lookups. (though the attributes for these may be different)

Alternatively on columns, and items in general expose access to the reverse linking map. That is the data structure which says what items are linking to a column. For example if Board A People Mirror mirrors Board B Owner column, we can query Board B Owner for linking_items {id, columns {id}, board {id}} and then we can see what is “mirroring” this column. 99% sure the reverse linking map exists someplace because otherwise the when status changes, do something templates that trigger off mirror statuses would not perform well at all.

1 Like

Hi Cody,

Thank you for bringing this up. I will flag this for our developers to look into this enhancement. Thank you for the feedback!

Best,
Joseph

1 Like