MDC API - Options to update an existing item

Hello,

I’d like to know what are the possible options to update an existing item in MDC. From API documentation I found one way to do it:

mutation {
    change_simple_column_value (board_id: 20178755, item_id: 200819371, column_id: "status", value: "1") {
        id
    }
}

Several questions:

  • Are there other API options to make an update?

  • In the above mutation why should we provide both item_id and borad_id? (board_id can be inferred from item_id…) In our system, we want to store just item_ids in the database. So to update an item we need first to query for item’s board_id, and then call the above mutation. This is two web requests per update.

  • Is there an option to make a single or bulk update based on custom column value? For example,

mutation {
    update_items(board_id: 20178755, column_id_to_look: "col1", column_value_to_look: "hello", column_id_to_update: “col2” column_value_to_update: "world") {
        id
    }
}

Which will update “col2” with value “world” for all items where “col1” has the value “hello”, in the mentioned board_id.

In our system, we already store custom ids to link between MDC items and DB items, so update by custom column is helpful here. And we also need to update several items in MDC per one item in our DB - would like to do it in one web request.

Thanks,
Marat

Hello @marat.z and welcome to the community!

I hope you like it here :muscle:

You can update the column values of your items using change_simple_column_value, change_multiple_column_values and change_column_value as explained here.

The board ID is necessary as of today because of the way the method is built.

You can use items_by_column_value as explained here and then use the IDs of the items to update them. You can’t do it in a single request.

Let me know if you have any other questions :slightly_smiling_face:

Cheers,
Matias

Hi @Matias.Monday,

Thanks for the reply, the options are clear now.

Similarly to change_multiple_column_values it would be great to provide a transpose method change_multiple_**rows**_values, which will accept list of item_ids, column_id and value to update. If we want to update a column with same value for N items we need to mutate N times, doing it in 1 mutation would be more stable and performant.

Talking about items_by_column_value, we need to provide board_id. Just wanted to confirm if there is (or not) an API to get items by column values without providing specific board_id - so it searches through list of relevant boards?

Thanks,
Marat

Hello @marat.z!

Thank you for that feedback about the batch actions via API :slightly_smiling_face:

I will share it with our team.

Regarding your question, you will always need to pass the board ID as of today.

Cheers,
Matias

Hello @Matias.Monday I have a similar query. I dont want to use item_id as my row id. My monday board has a column (column_id = text) and here I have added some testcase ids. Now I have another column with Status which will be filled as per execution status from my pipeline/manua test run. I do not want to use item_id as my id. How can i pass ‘text’ column as my id. I have tried these ways but doesnt help -

    $query = 'mutation ($columnVal: String!) { change_simple_column_value (board_id: 2872973685, column_id(*to refer*): text, value(*testcaseID*): @wwn-324 , column_id(*to update*): status, value(*testExecutionStatus*): $columnVal) { id } }';


    $query = 'mutation ($columnVal: String!) { change_simple_column_value (board_id: 2872973685, column_id: text, value: @wwn-324 , column_id: status, value: $columnVal) { id } }';

Hello @shabnam and welcome to the community!

I hope you like it here :muscle:

change_simple_column_value can be used to update only one column at a time.

For example:

mutation {
  change_simple_column_value(board_id: 1234567890, item_id: 112233445566, column_id: "text", value: "New text") {
    id
  }
}

You can not add two column_id to this mutation.

If you want to change multiple columns, you can use change_multiple_column_values.

I hope that helps!

Cheers,
Matias

Hello @Matias.Monday Thanks for your reply. Monday.com is really helping me and i am using as a Test management tool.

My doubt was to update a single column only , but i want to pass 2 ids as and identifier for the row.
id1 = board_id
id2 = Test Id (but i dont want it to be item_id)

My monday board looks like this -

So I want to pass in the query , id1 and id 2 to update Status for that particuar row.
The reason i dont want to use item_id is because I have to append these monday item_ids to my test framework and raise a huge Merge request (which i want to avoid)
So is there any way where I can do this . A query where i can pass 2 or more than 2 column_ids and change value of another column for the row.

Note - Another reason for not using item_id is our for our Testcases - One testcase runs on mobile,desktop and tablet (parrallely on jenkins pipelines)
So I cannot use the same item_id for this testcase because the Status column can be misleading(is it pass or fail for mobile/desktop/tablet)
So if we can pass 2 identifiers as id, for example - TestID, @mobile along with Board id and then update Status. This will be perfect solution for my problem :slight_smile:

Thanks

Hello again @shabnam!

Regarding the arguments you can use in the queries/mutations, you can only pass IDs that are related to monday elements such as boards or items.

You could add text columns to your board that hold other IDs for each item, but you will not be able to pass that as an argument in the query.

You could have said columns and then use items_by_column_values to identify using those external IDs, the ID of the item, to then do something with it.

Let me know what you think!

Cheers,
Matias

Hello to you too @Matias.Monday and @basdebruin , I will check the options.
I am also thinking of a possibility to solve the above case like this -
Created two boards and connected the status column.
1.Board 1 - will have all the automated testcases integrated with my Test Automation framework and the testcases run in CI/CD pipeline.

Board 2 - Is have rows with all testcases (manually added) as per mobile/desktop/tablet.

Now I want to create an automation that -

  1. When, for example - Platform (name of column of type status) is mobile and it is Passed/Failed , in board 1, then update the status of mobile testcase on board 2.

But when i checked for Automations on monday, all i see is ‘create’ new item/subitem. There is no ‘modify’

Hello again @shabnam !

You can create a flow using the action “Change status”