- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 04:33 AM
Hi Expert
I have a requirement to implement in all ITSM module, "As an IT user should have the ability to assign tickets only to IT groups. This should be across all ITSM modules .Also if tickets are assigned to any groups without members should giving warning message " Please select a valid group which has members" .
What I mean is when an user having ITIL role then in the assignment group he/she should able to view only group those are belongs to itil. I mean in the group table if the group "type" is "itil" then that assignment group will visible to ITIL user. Also there is no user availabel in the select assignment group then it should throw a warning message " Please select a valid group which has members" .
Please help with the requirement. What type of script or configuration I have to write here.
Thanks in advanced.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 03:38 AM
You should create a business rule on incident table and should run on update. the condition should be when assignment group changes and assignment group is not empty.
Below script should satisfied the requirement :
var assignmentGroup = current.assignment_group;
//Glide group member table
var gmember = new GlideRecord('sys_user_grmember');
gmember.addQuery('group',assignmentGroup); // query assignement selected group
gmember.addQuery('user', '!=', ''); // check for user
gmember.query();
if(!gmember.next())
{
gs.addInfoMessage('Please add a group with members');
}
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 06:24 AM
In order to make only itil group available on assignment group field. you need to set simple reference qualifier where you can put a conditions "type is itil" through condition builder. This will only show those groups whose type field is set as itil.
If you want this to happen over each table then you have to make changes on task table's assignment group field. But keep in mind that with each upgrade you need to maintain this.
the other way is to individually do a dictionary overwrite on each table's assignment group field.
To show a message that group is empty, you can use below given script in a before business rule.
var assignmentGroup = current.assignment_group;
//Glide group member table
var gmember = new GlideRecord();
gmember.addQuery('group',assignmentGroup); // query assignement selected group
gmember.addQuery('user','!=,'''); // check for user
gmember.query();
if(!gmember.next())
{
gs.addInfoMessage('Please add a group with members');
}
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 06:59 AM
HI
Thanks for giving the quick response. The condition you are asking me put, I guess it will execute for all user. What I want is if the user is belongs to itil then in the assignment group i have to shows the group those belongs to itil type. Please correct me if I am wrong here. My requirement is if user belongs to IT then I have to shows the group in the assignment group field whose type is itil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 07:10 AM
In that case you have to write an script include. Reference qualifier should of advance type and then need to call the script include.
Below is the screenshot, how to call a script include in reference qualifier.
This script should help you, please change few value as suggested by comments.
getAssignmentGroup: function(){
if ((!gs.hasRole("admin") )&& gs.hasRole("itil"))
{
return 'type=1cb8ab9bff500200158bffffffffff62'; // replace sys_id with group type sys_id (itil)
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:37 PM
Hi Mehta
I tried with the above script you have mentioned. But when I test the scenario it is not restricting the assignment group as type itil. I can see all the assignment group even if user is having itil role. Then I did below change in the script. Now I am able to see all the assignment group those are having the type as itil and user is having itil role. but the problem it is working for all the users. not specific to itil user. Whether user is admin, itil or anything else, now in the assignment group i could only the group those type is itil. Could you please help me restricting the data for non itil users. Below is the script I am using currently.
var getAssignment = Class.create();
getAssignment.prototype = {
initialize: function() {
},
getAssignmentGroup: function(){
if (gs.hasRole("itil"))
{
return 'type=1cb8ab9bff500200158bffffffffff62'; // replace sys_id with group type sys_id (itil)
}
},
type: 'getAssignment'
};