How to auto assign incident to a particular group based on few words in description

Renu9
Tera Contributor

Hi All,

I want to auto assign an Incident to a group based on few words in the description field. Please let me know how I can do that. Few words such as bot, UI path, rpa , etc etc. I am trying with one word as of now, but it is not working. Please guide

 

if(producer.description.toLowerCase().indexOf('RPA')>=0)
{
    gs.addInfoMessage("testing rpa");
    current.assignment_group="77c9b13d1bfe205026de123edc4bcb9a" ; //RPA team
}
11 REPLIES 11

@Renu9 It can check from your Conditon builder itself considering you are checking it on the "Description" field on the Incident form.

 

I have checked it myself with Case-sensitive description words, and it works!

Let me know if it works for you

It works for me, check the below screenshots

AniketBhanse_0-1698917373925.png

 

AniketBhanse_1-1698917409151.png

 

 

Assignment Rule does considers "Case-sensitive" words as well.

 

Also, it is a good practice to use OOB Servicenow functionality rather than scripting it.

Vishal Birajdar
Giga Sage

Hi @Renu9 

 

In the record producer script write below code :

 

var desc = producer.description.toString();

if(desc.includes('rpa')){

current.assignment_group = 'sys_id_of_group';
}

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Ankur Bawiskar
Tera Patron
Tera Patron

@Renu9 

why not use assignment rule for this?

If you want to use record producer script then here is the syntax

var description = producer.variableName; // give here the variable name

if(description.indexOf('bot') > -1 || description.indexOf('UI path') > -1 || description.indexOf('rpa') > -1){
	current.assignment_group = '77c9b13d1bfe205026de123edc4bcb9a';
}

You can also use Before insert BR and handle it without script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar 

I have put the same script and  the log is not displaying, the Incident is not getting assigned to any group.

var description = producer.variableName; // give here the variable name

if(description.indexOf('bot') > -1 || description.indexOf('UI path') > -1 || description.indexOf('rpa') > -1){
gs.addInfoMessage("test");
	current.assignment_group = '77c9b13d1bfe205026de123edc4bcb9a';
}