We are using CRM, and have an “Account” column on the “Deals” board that is a connect_board column type. using the API, I want to update a column on the first linked_item (i.e. the Account for the deal) when that Account gets created in an external system. I’m struggling to figure out how I structure the “columnValues” for this mutation, any suggestions? If I could get the boardId for the linked item, then it would be easy, but since I access the item through the connected column, I don’t have a boardId to use - can I update the Account column through the linked_items, or do I need to do something else?
Hi Paul,
I’m not an expert in this area so hopefully there’s is others who will support this one see something to test: To update a column on the first linked item (the “Account” in your case) using the API, you need to follow a series of steps to retrieve the necessary information and perform the update. Here’s a step-by-step guide to help you with this process:
Steps to Update a Column on the First Linked Item:
-
Retrieve the Linked Item ID:
-
Use the API to query the “Deals” board and get the item ID for the deal you are interested in.
-
Once you have the item ID for the deal, query the “connect_board” column to get the linked item IDs. This will give you the ID(s) of the “Account” items linked to the deal.
graphqlquery { items(ids: [DEAL_ITEM_ID]) { column_values(ids: "connect_board_column_id") { value } } }Replace
DEAL_ITEM_IDwith the actual item ID of the deal andconnect_board_column_idwith the ID of your connect_board column. -
-
Parse the Linked Item ID:
- The response will include JSON data with the linked item IDs. Parse this JSON to extract the first linked item ID, which corresponds to the “Account.”
-
Find the Board ID for the Linked Item:
- Although you mentioned not having the board ID, you can usually infer it from your setup since the “Account” items are on a specific board. If you have access to the account board separately, you can use its ID directly.
-
Update the Column on the Linked Item:
- Use the
change_column_valuemutation to update the column on the linked item (the “Account”).
graphqlmutation { change_column_value(item_id: ACCOUNT_ITEM_ID, board_id: ACCOUNT_BOARD_ID, column_id: "column_to_update", value: "new_value") { id } }Replace
ACCOUNT_ITEM_IDwith the ID of the linked account item, **ACCOUNT_BOARD_ID**with the ID of the board where the account resides,column_to_updatewith the ID of the column you wish to update, andnew_valuewith the value you want to set. - Use the
Hopefully this should allow you to update a column on the first linked item effectively using the API. If you encounter any specific issues or need further assistance, feel free to ask!
Thanks, that all tracks with what I already knew, but Step #3 is the part that bothers me.
It makes little sense (to me) that you have to step outside of the API context to gather some information (board_id) that enables me to update an item that I retrieved through the API. In my specific use case, the item could have been created through a couple of different boards, so retrieving programmatically is much safer/more durable. Is there a way to retrieve the definition of a board that could tell me the column schema, including the board_id that the column refers to?
Hi Paul, I’m not exactly sure of the full scenario without more detail about your use case etc. If you want to have a call could review to see if I could support further?