The CreatorCon Call for Content is officially open! Get started here.

Assigning incident to specific assignment group based on category

gnunez
Kilo Guru

Hello all,

I created a record producer with 2 categories (Project, Software) and a couple of subcategories. The request is that if a certain category "Project" or its corresponding subcategories is selected then it should be assigned to assignment group "ABC", else it should be assigned to group "123".

I had included a line of script when it was only assigned to one person, but now that this requirement came up it no longer works. Is there a line of script I can add to separate the two, possibly an else statement?

Below is what currently is in place:

find_real_file.png

**We are on Istanbul

Thanks in advance!

Grace

1 ACCEPTED SOLUTION

Your script shud be like below


if(current.category == 'inquiry' && (current.subcategory == 'antivirus' || current.subcategory == 'email'))


{


current.assignment_group = 'b85d44954a3623120004689b2d5dd60a';


}


else if(current.category == 'software' && current.subcategory == 'os')


{


current.assignment_group = 'aaccc971c0a8001500fe1ff4302de101';


}


Regards
Harish

View solution in original post

7 REPLIES 7

The SN Nerd
Giga Sage
Giga Sage

Have you checked out the Assignment Lookup Rules capability to see if that meets your requirement?



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Thank you Paul for the suggestion! We have lookup rules set for the categories/subcategories for create new incident but this a record producer that has its unique category/subcategory.


Harish KM
Kilo Patron
Kilo Patron

In record producer script you can have like this


if(current.category == 'inquiry' && current.subcategory == 'antivirus')


{


current.assignment_group = 'b85d44954a3623120004689b2d5dd60a';


}


else if(current.category == 'software' && current.subcategory == 'email')


{


current.assignment_group = 'aaccc971c0a8001500fe1ff4302de101';


}


Regards
Harish

Hi Harish,



Thank you for the script! I was able to set the assignment group for the first category "Project", but the else statement doesn't seem to be working because when the other category "Software" is selected it assigns to same assignment group as project.



This is what I have:


find_real_file.png



Thanks,


Grace