How to automatically add Tags in Incident form after clicking a button

Raphael Dizon
Mega Expert

Hi,

I want to know if it's possible to automatically assign tags in an incident form using a button. We have two buttons named Create JobOrder and POS Printer that works just like creating a new incident task ticket. I want to automatically assigned tags when one of these buttons are clicked so that I can specify in their UI Actions Condition that whenever there is a Job Order tag, only the 'Create JobOrder' will display and the 'POS Printer' button will be hidden and vice versa. Thanks

find_real_file.png

Regards,

Raphael

1 ACCEPTED SOLUTION

Yes, You can sample way 

function moveToClosed(){
g_form.setMandatory('field','value');
g_form.setMandatory('field','value');
g_form.setMandatory('field','value');
gsftSubmit(null, g_form.getFormElement(), "**********");
});
}

if (typeof window == 'undefined')
createTag();

function createTag() {
var gr = new GlideRecord('label_entry')
gr.initialize();
gr.label ='sys id of tag';
gr.table ='incidet';
gr.table_key ='sys_id of inicdent'
gr.insert();
}

View solution in original post

6 REPLIES 6

sachin_namjoshi
Kilo Patron

You can configure these UI actions to create record in label table.

Tags are stored in label table.

You can find all existing tags using label.LIST 

 

Regards,

Sachin

Hi,

Should I add the code here in my UI Action?

find_real_file.png

Naveen Velagapu
Mega Guru

Create entry in "label_entry" table based on your conditions in the UI action  or any associated script that is getting triggered.

while creating you should provide "label" --> Tag ,"table" --> table name,"table_key" --> table sys id.
Tag you are assigning should already exist in SNOW.

Please hit helpful if this answers your question.

 

thanks,

Naveen

Hello,

This is the script of my UI Action. Can I also add the script that auto-populates the tag in our incident form?

find_real_file.png