How to auto assign incident to a particular group based on few words in description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 01:39 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 02:26 AM
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 02:31 AM
It works for me, check the below screenshots
Assignment Rule does considers "Case-sensitive" words as well.
Also, it is a good practice to use OOB Servicenow functionality rather than scripting it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 02:23 AM
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';
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 02:32 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 03:18 AM
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';
}