We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Update the Tag value in incident form through API

karishmaafr
Tera Contributor

In incident form can we add Tag value through API ? What is the possible or different way through API to do this ?

2 REPLIES 2

Vikram Reddy
Tera Guru

Hi @karishmaafr,

 

There's no tag field on the incident table itself. Tags sit in their own tables and get linked to the incident, so what you're really doing through API is an insert, not a form update. Same logic whether it's a background script or an external call:

  • the label table holds the tag itself, query it by name and create it first if it doesn't exist
  • the label_entry table is the actual link: set label to the tag's sys_id, table to "incident", and table_key to the incident's sys_id
  • the Table API hits label_entry the same way if you're doing this from an external integration

One thing to watch: table and table_key on label_entry are ACL-locked to the maint role out of the box, so a non-elevated script or scoped app can insert the record fine but those two fields come back blank. Other folks have hit this exact issue on the community, and the fix is a custom ACL granting write on those two fields to whatever role your integration runs as. There's also a good writeup on the scripted side of tagging here if you want to see it done in a business rule instead of a raw API call.

 

Thank you,
Vikram Karety
Octigo Solutions INC

Tanushree Maiti
Tera Patron

Hi @karishmaafr 

 

 

Refer: Create Incident with new tag or tags using the API 

Adding tags to new incident using API 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti