- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 08:50 AM
I want to add tag to a record while creating a record from a script. Tried to create a tag in the Tags table and used :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:04 AM
Hi @samadam,
It's not actually possible to add a tag with a simple one liner (I assume without visibility of your whole script), but you can add the tag using similar syntax to the below:
var tagGR = new GlideRecord('label_entry')
tagGR.initialize();
tagGR.label = 'sys id of tag';
tagGR.table ='incidet';
tagGR.table_key = 'sys_id of incident'
tagGR.insert();
Please also note, it is possible to assign a tag automatically through match conditions defined in the tag record. Check the SN Docs link for more info:
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:04 AM
Hi @samadam,
It's not actually possible to add a tag with a simple one liner (I assume without visibility of your whole script), but you can add the tag using similar syntax to the below:
var tagGR = new GlideRecord('label_entry')
tagGR.initialize();
tagGR.label = 'sys id of tag';
tagGR.table ='incidet';
tagGR.table_key = 'sys_id of incident'
tagGR.insert();
Please also note, it is possible to assign a tag automatically through match conditions defined in the tag record. Check the SN Docs link for more info:
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:05 AM
This is what I ended up doing and it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2025 09:09 AM
Awesome! Thanks for circling back @samadam and helping others in the community.
Happy Tuesday ; )
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
