Create Incident with new tag or tags using the API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 06:31 AM
Hi community,
When I create a task (incident) using the API and include values in the `sys_tags` field, the incident is created successfully, but the tags are not created or linked to the incident. I've read some posts suggesting that this might be possible by first creating new tags using a POST request to `https://xxxxxx.service-now.com/api/now/table/label` and then linking them using a POST request to `https://xxxxxx.service-now.com/api/now/table/label_entry`. However, even after trying this in Postman, I still don't see the tags associated with the incident when I retrieve it. Where can I find more documentation on this? I work with very large clients who have thousands of tags.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 06:49 AM
Can you share the post entry you're doing to label_entry?
Disclaimer: I've never done tagging via an API. I'm not a massive fan of tags 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 04:05 AM
Hi Kieran,
https://xxxxx.service-now.com/api/now/table/label_entry
{
"label": "1614a45e3b739a108a6ed29aa4e45af7", // sys_id of the label
"table": "incident",
"table_key": "81a8fcd6ebbf9a101a4df4f2bad0cde6" // sys_id of the incident
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 04:07 AM
Hi Kieran
POST -->https://xxxx.service-now.com/api/now/table/label_entry
{
"label": "1614a45e3b739a108a6ed29aa4e45af7", // sys_id of the label
"table": "incident",
"table_key": "81a8fcd6ebbf9a101a4df4f2bad0cde6" // sys_id of the incident
}
Thank you for the fastest respond.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 07:00 AM
Looks like writing to table and table key is the issue. I would look at creating a scripted REST API, and use the undocumented GlideLabelUtil to add a label. This Glide API will create a label_entry record with all of the correct field values. You can see its use in the script include 'LabelsAJAX'
