How to add a tag to the “Tags” field in the Alert [em_alert] table using a script in subflow?

Snowl13052025
Tera Contributor

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!

2 REPLIES 2

Najmuddin Mohd
Mega Sage

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.