- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 10:38 AM
We have a slew of assignment rules and would like to concatenate them into one for incidents and one for requests. To do that, I attempted a simple script on an assignment rule to see if it function but can not get it to do anything. We are on Version Utah so I don't have the newest bells and whistles. I attempted this in my script area of my rule:
if current.category == "Enterprise Applications"
current.assignment_group = 'sys_id_of_my_group';
else
current.assignment_group = 'sys_id_of_default_group';
We have over 34 incident rules I need to get in a large if or switch statement. Just trying a simple one for verification. What am I doing wong? The "example" in the blank assignment rule didn't work either. It is not assigning any group.
* if (current.category == "Hardware")
* current.assignment_group.setDisplayValue("Hardware");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 10:49 PM
Hello @sbeckers3 ,
Give a try to the script below and see how it works for you , also you can further modify it as per your use case.
// Concatenated Assignment Rule Script for Incidents
// Check for category and set assignment group accordingly
if (current.category == "Enterprise Applications") {
current.assignment_group.setDisplayValue('sys_id_of_my_group');
} else if (current.category == "Hardware") {
current.assignment_group.setDisplayValue('sys_id_of_hardware_group');
} else if (current.category == "Software") {
current.assignment_group.setDisplayValue('sys_id_of_software_group');
} else if (current.category == "Malware") {
current.assignment_group.setDisplayValue('sys_id_of_security_group');
} else {
// Default assignment group if no specific category matches
current.assignment_group.setDisplayValue('sys_id_of_default_group');
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 09:49 PM
Hi @sbeckers3 ,
Can you try below script?
if (current.getDisplayValue('category') == "Enterprise Applications"){
current.assignment_group.setDisplayValue('<nameofgroup>');
}else{
current.assignment_group.setDisplayValue('<nameofgroup>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 10:30 PM
If(current.category=="HW")
current.assignment_group.setDisplyValue("groupName")
else...
Make sure check if any different assignment rules available for these categories or groups...if not then only it would work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 10:49 PM
Hello @sbeckers3 ,
Give a try to the script below and see how it works for you , also you can further modify it as per your use case.
// Concatenated Assignment Rule Script for Incidents
// Check for category and set assignment group accordingly
if (current.category == "Enterprise Applications") {
current.assignment_group.setDisplayValue('sys_id_of_my_group');
} else if (current.category == "Hardware") {
current.assignment_group.setDisplayValue('sys_id_of_hardware_group');
} else if (current.category == "Software") {
current.assignment_group.setDisplayValue('sys_id_of_software_group');
} else if (current.category == "Malware") {
current.assignment_group.setDisplayValue('sys_id_of_security_group');
} else {
// Default assignment group if no specific category matches
current.assignment_group.setDisplayValue('sys_id_of_default_group');
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 07:11 AM
So that did not work but a combination of all the responses did..
This is what I ended with that worked.
if (current.getDisplayValue('category') == "Enterprise Applications") {
current.assignment_group.setDisplayValue('sys Id of group');
}
else {
current.assignment_group.setDisplayValue('sys Id of default group');
}
Thanks