Skip to main content

I am experiencing difficulty creating items with tag column values. The items create, but the tag values are not being set.


I saw from this previous question that tags need to be created and then passed as ID to the create_item call:



So my first mutation to create the tag is this:



mutation { create_or_get_tag (tag_name: "myNewTag", board_id: 785566686) {
id
}
}


I then use that ID to create the item with the tag_ids like so:



mutation { 
create_item (
board_id: 785566686,
group_id: "group_title",
item_name: "item_name",
column_values: "{\\"status\\":{\\"label\\":\\"Medium\\"},\\"tag\\":{\\"tag_ids\\":"7481612]}}"
) { id }
}


When I perform that mutation from the API explorer, it is successful, but I am not seeing the tag on the new item in my board. Is there something wrong with the way I am trying set the tag values in the column_values? ( note, status does set correctly ).


cc / @Scott-monday.com

Hey @mdev - welcome to the community!


The create_or_get_tag mutation is fairly new - let me try and re-create this behavior on my end with the team and get back to you.


Could you let me know if this was previously working for you?


-Daniel


@dsilva No, I wasn’t able to get it to work from the api explorer or from the monday javascript sdk.


Here is a clip of the issue:


Hey @mdev - apologies for the delay! This took a bit more testing on our end to resolve.


We used the following query to create the tag and get the ID, just like the one you posted above:


mutation { create_or_get_tag (tag_name: "HelloWorld", board_id: xxxx) {
id
}
}

From there, we modified the ‘create_item’ query you provided to send the information needed to the API in JSON format:


mutation { 
create_item (
board_id: xxxxx,
item_name: "This is my item",
column_values:"{\\"tags\\":{\\"tag_ids\\":\7583426]}}"
) { id }
}

One thing I did notice is that if a board does not have any tags at all, you won’t see them appear until you refresh your browser.


Hope this helps!


-Daniel



@dsilva


It looks like the issue was the tag column name I was using. the actual name value had to be tags36 for my particular case.


I guess ill need to query the board to check which column is a tag type to determine the name before creating the item, rather than assuming it will always be tags.


Thank you!


Reviving this threat - I tried the following:


vars = {"myItemName": "test!","columnVals": json.dumps({"link": {"url":"wwww.google.com","text":"google.com"},"people1":"14123922,12472244","tags":{"tag_ids":"#fdfd3"}}),}


The name hasn’t changed in my case. The tag doesn’t appear at all - even after reloading the page.


Hey @tuesdayman - could you try the above query without the number sign?


-Daniel


@dsilva the entire query results in no output.


See below:


vars = {"myItemName": "2342323!","columnVals": json.dumps({"link": {"url":"wwww.google.com","text":"google.com"},"people1":"14123922,12472244","timeline":{"from":"2019-06-03", "to":"2019-06-15"},"tags":{"tag_ids":"fdfd3"}})}

@tuesdayman Should columnVals be column_vals? Have you tried using the API explorer?


If you use it, you can also confirm the tag name / id values for the board you are trying to create an item for.