Add Linked Item to Connected Column Without Overwriting Existing Connected Items

Hello, I am attempting to build a custom integration that will search a Customers board for existing customers based on multiple columns. This is why I’m not using the built automation recipe for connecting items where columns match. For more details: I’m using phone number and email column to search multiple customer boards and if they match the intended functionality is that it will connect the customer to the quote.

Issue I’m running into, is that when I do this I don’t know of a way to add a connected item without overwriting the existing ones.

What I’m guessing is a way to do this:
Query the existing connected column before mutation and appending the new item id to the existing list of item ids if there are any. Then mutate using this new list of item ids.

What I’m hoping I can do:
I noticed that when I query a connected boards column I get the following response:

'{"changed_at":"2022-05-30T23:33:26.358Z","added_pulse":[],"linkedPulseIds":[{"linkedPulseId":123456789}]}'

I’m hoping that the “added_pulse” can be mutated and I’m just not finding it in the documentation on how to do that?

Currently when I mutate with this format it overwrites the existing linked items instead of appending:

mutation {
  change_multiple_column_values(item_id:11111, board_id:22222, column_values: "{\"connect_boards2\" : {\"item_ids\" : [12345, 23456, 34567]}}") {
    id
  }
}

Any insight here is appreciated.

Hello @christian.lee!

I think you are on the right track here.

Why would retrieving the IDs of the current connected items and then, adding those to the new item IDs in the mutation be an issue?

@Matias.Monday
I wouldn’t say it is an issue, but it is an extra few layers of complexity. Much more efficient to just add the new item to the connected items, instead of running a whole query, then looping through existing connected items, while checking if I should append to that list or (if new connection is only one) just connect it. Rather than just a query to add the new connected item without overwriting and just receiving a response from the API with the new list of ids.

With this all in mind I just wanted to make sure I wasn’t missing something in the documentation before adding that complexity to my integration. Extra operations means extra billing costs on external servers, and less API calls remaining per minute.

Again not really an issue here, just wanted to make sure before going the route I was thinking :slight_smile:

Hello @christian.lee!

I can confirm you are not missing something from the documentation and you have the right idea of how to achieve this. With that, I hear what you’re saying in regards to complexity, and I’m happy to pass this feedback on to our R&D team for review. We are constantly looking for ways to improve our API.

Let us know if you have any more questions as you build this integration. As always, we are here to help!

Cheers,
Alessandra

1 Like