How to get 'sys_tags' field value on Incident API for all the tagged incidents

savitha5
Tera Contributor

Hi All,

I have got a requirement to share incident API which should include Tags field too.
The API shows sys_tags column on Response part but the value is not displaying, unless if the Incident is tagged to the logged in user account.

For example: I have tagged an Incident as System Administrator and ran API in different login, the value is not retrieved. I got the below response.

find_real_file.png

but same API works fine for System admin

find_real_file.png

I got suggestions like create custom field and copy Tag values by querying from label_entry table, we are not trying it.
Can somebody let me know if we have any role or something which can be granted to our web service user account.

Thanks in Advance!
Savitha

 

 

3 REPLIES 3

Chris35
Giga Expert

Hello,

I think these values are taken from Tags table (label.list in the app navigator if not Tags under System definitions)


If there are concrete existing labels, then an alternative can be to change: "Viewable by", to everyone and try again.
Possible configuration directly on this table if this approach works, and if you want dynamic results from the API

SatheeshKumar
Kilo Sage

Hi,

 I think the workarround will be  creating a new field to store the tags. To do that follow the below steps:

1)Create a field on incident table.

 

2)query on "label_entry" table "table_key" field with incident sys_id.

 

3) Get label.getDisplayValue() and add in the field you created on incident table.

 

Iam not sure that there is a way to get the tag field directly!.

 

-satheesh

SatheeshKumar
Kilo Sage

check the below link, it may help you. I think the tags follow some rules for visibility. thats why it is not showing for all users as admin.

 

https://docs.servicenow.com/bundle/madrid-platform-user-interface/page/use/common-ui-elements/concept/c_Tags.html

 

-satheesh