- 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 11:50 AM
Can you just do below?
var tor = current.request_item.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-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");
}