- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 10:35 AM
Good afternoon! I have a select box with 3 choices in my Catalog Item. According to what the choice it would be I will assign to different assignment groups.
choice 1 - assisnment group 1
choice 2 - assingmnt group 2
choice 3 - assingmnt group 3;
I wrote a script to insert in Assignment Rule. But only the ELSE is being recognized. Someone can see what's wrong with my If's?
CODE:
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
var tor = ritm.variable_pool.choose_your_type_of_incident;
if(tor == 'software') {
current.assignment_group.setDisplayValue("Software");
}
else if(tor == 'hardware'){
current.assignment_group.setDisplayValue("Hardware");
}
else{
current.assignment_group.setDisplayValue("Network");
}
I will post below screenshots.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2022 04:01 AM
This code works!
:
var tor = current.variables.choose_your_type_of_incident;
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
ritm.query();
gs.addInfoMessage('tor is '+tor);
if(tor == 'software') {
current.assignment_group.setDisplayValue("Software");
}
else if(tor == 'hardware'){
current.assignment_group.setDisplayValue("Hardware");
}
else{
current.assignment_group.setDisplayValue("Network");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 10:42 AM
Can you try below. Added a debug statement to see what value is coming in tor
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
var tor = ritm.variables.choose_your_type_of_incident;
gs.addInfoMessage('tor is '+tor);
if(tor == 'software') {
current.assignment_group.setDisplayValue("Software");
}
else if(tor == 'hardware'){
current.assignment_group.setDisplayValue("Hardware");
}
else{
current.assignment_group.setDisplayValue("Network");
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 10:56 AM
tor is undefined

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 11:06 AM
Your screenshot shows ritm.get(current.variables.request_item). Did you correct it to ritm.get(current.getValue('request_item'))
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 11:19 AM
yes, i did! still only recognizing/assigning to "network".... only the Else. also, tor undefined. weird :((