We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

I have to add conference tag in incident.

niveditakumari
Giga Sage

Hi, 

 

Whenever an incident is assigned from abc to xyz we would like to add "Conference Room Issue" tag to the incident along with the existing configuration in flow and we are having flow for that catalog item. 

niveditakumari_0-1770719785868.png

 

Can anyone please help me how to add conference tag in incident. 

 

Regards, 

Nivedita 

 

 

31 REPLIES 31

Hi @Ankur Bawiskar

 

I tried business rule and it is working as per code which is written in above article. 

I have added story conference tag in above code it is not adding conference tag as per story. 

Please see attached screenshot : 

Incident list community tag is added that is mentioned in above given link and after that have just changed with conference room tag it is not getting added see Test1111 incident. 

niveditakumari_0-1770734765617.png  

 

Code : 

(function executeRule(current, previous /*null when async*/) {

// Comma seperated list of Tags
var tagsArr = 'Conference Room Issue';

// Iterate thru the Array and create the Tags and Label Entries
tagsArr = tagsArr.split(',');

for(var i = 0; i < tagsArr.length; i++) {
var tagSysId = '';

var grTag = new GlideRecord('label');
grTag.addActiveQuery();
grTag.addQuery('name', tagsArr[i]);
grTag.addQuery('type', 'standard');
grTag.addQuery('viewable_by', '!=', 'me');
grTag._query();

if(grTag._next()) {
tagSysId = grTag.getUniqueValue();
} else {
grTag.initialize();
grTag.setValue('name', tagsArr[i]);
grTag.setValue('viewable_by', 'everyone');
grTag.insert();

tagSysId = grTag.getUniqueValue();
}

var grTagEntry = new GlideRecord('label_entry');
grTagEntry.initialize();
grTagEntry.setValue('label', grTag.getUniqueValue());
grTagEntry.setValue('table', current.getTableName());
grTagEntry.setValue('table_key', current.getUniqueValue());
grTagEntry.insert();
}

})(current, previous); 
 
Conference tag : 
niveditakumari_1-1770734958207.png

Can you please help me to correct code to add conference tag in incident. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

entry into label_entry got created for your incident?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar

 

Entry into label_entry that not created for my incident. 

Can you please help me to correct that. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

if tag is getting created, then it should create entry into label_entry table

try to add this line in your script

        grTagEntry.setValue('title', 'Incident - ' + current.number);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar

 

I have checked in label_entry table record has been created and first two record has been created for my testing. 

niveditakumari_0-1770745789063.png

 

it is not adding conference tag in incident list. 

Can you please help me to add conference tag. 

 

Regards, 

Nivedita