Add Thread Comment API - how to find the string needed for comment.mentions[].code

What string do I  use to mention a department when using the Add Thread Comment API?

The description of the comment.mentions[].code parameter states that I would need to place in the code of a department to mention that department in my API comment.
I tried placing in the name of my department (which is “Human Resource Management”) but the API responds with an error of “The specified department (code: Human Resource Management) not found.”, so I’m obviosuly not placing in the right value there.
I’m guessing there should be some sort of unique code for this department - any ideas on where I can find this?

Hello Akira!

As you already assumed, you need to enter the department code in there. If you have the administrative privilege, you can check the code for the department by the following procedure:

1)Access “Departments & Users” under “User Administration” at “Administration Home”
2)Under “Departments”, click “Edit” from the gear icon that appears next to the department of the code that you need.
3)You should see a column called “Department Code” and that will be the code that you need.

If you do not have the administrative privilege, you can just go to a record detail page that has the department that you need the code for and run “kintone.app.record.get()” at the browser console. In response, the record information will return so the department code should be in it.

I hope that helps your question!

Hi Yuzo, thanks for the advice! Working perfectly fine now :wink: