How to add a tag to the “Tags” field in the Alert [em_alert] table using a script in subflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2025 10:53 PM
Hello Everyone.
Hi everyone,
I’m trying to add a tag to the Tags field in the Alert [em_alert] table using a script in subflow . Could someone please help me with the correct script or method to do this and how to call and us in subflow?
I’d appreciate it if you could also explain .
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 12:19 AM
hey, you can check those community posts:
https://www.servicenow.com/community/developer-articles/scripted-tags/ta-p/2306155
https://www.servicenow.com/community/itsm-forum/adding-tag-to-a-record/td-p/3195697
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 12:28 AM
Hello @Snowl13052025 ,
you can use the below script.
var gr = new GlideRecord('label_entry');
gr.initialize();
gr.label = 'SYS_ID of the tag'; // stored in the label_list table
gr.table = 'em_alert'; // sys_id of the table
gr.table_key = 'SYS_ID of the record';
gr.title = 'Alert - ' + 'Alert_Number'; // Title
gr.read = 'yes';
gr.insert();
When we are creating tags, in general we are creating a label entry record, where we associate a Tag(label) and the record(table_key).
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.