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

@niveditakumari 

it worked for me when I ran in background script

AnkurBawiskar_0-1770780108500.png

💡 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

 

Business rule: 

niveditakumari_0-1770800923199.png

(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); 
 
Incident list: 
niveditakumari_1-1770800991446.png

 

niveditakumari_2-1770801032330.png

 

Label_entry list: It has been created record in label_entry table. 

niveditakumari_3-1770801059185.png   

 

 
Conference tag : 
niveditakumari_4-1770801246798.png

 

 
It has not added conference tag in incident it should add conference tag in incident when incident is created with assignment group Tier 1 group. 
When i tried with community tag which is mentioned in code which you have given that is added as community tag in incident and when I have changed in code that to my conference tag it is not added conference tag in incident. 
Can you please help me to correct that. 
 
Regards, 
Nivedita 
 
 

@niveditakumari 

try to use After Insert instead of Async insert

💡 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 created using after insert and tag is not added. 

Please find attached screenshot : 

niveditakumari_0-1770804651402.png

 

niveditakumari_1-1770804691100.png

 

Can you please confirm my script is correct or need to make change in that. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

script is correct.

did you try to test it from background script by passing table name and record sysId?

💡 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