- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 12:08 AM
How to find non admin user in servicenow, he must have permissions to raise Ritm
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2019 03:57 AM
Can you add the log statement in the script include after this line and tell me the log output.
var thisUser = gs.getUser().getUserByID(userID);
gs.log("Group name is "+groupName+"----"+userID);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 12:25 AM
Hi,
An End user can also raise and RITM using catalog and portal. What is your ask?
THanks
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:37 AM
Hi ashutosh,
My requirement is : I have 4 catalog items, all the items have same "grid task" is generated in ritm as first, Once the task changes to closed complete the variables tab on ritm form should be read only for all the users except the ADMINS and Y Group members.
For this i wrote script include and client script , I dont know whether its working properly are not, Could please check it once and let me know if any changes are their
If is there any way to do the above requirement please provide the solution
Script include
var MyGroups = Class.create();
MyGroups.prototype = {
isGrpMember : function() {
var userID = this.getParameter('sysparm_userID');
var groupName = this.getParameter('sysparm_groupName');
var thisUser = gs.getUser().getUserByID(userID);
if (thisUser.isMemberOf(groupName)) {
return true;
}
else {
return false;
}
},
} type:'MyGroups';
Client script on ritm table
function onLoad() {
//Type appropriate comment here, and begin script below
var item=g_form.getValue('cat_item');
if (item=='e7d48d55db5f8b00c77b7016bf96199b' || item=='e386bfb3dba68700c77b7016bf961943' || item =='ae244264dbb6c700c77b7016bf961944' || item== '1813429bdb83c700f3e5f156bf9619e9' || item== '0d0c3f5adb28e3001ac0105f6896198e' || item =='f2377d15db9f8b00c77b7016bf96191c' || item=='f477b155db9f8b00c77b7016bf961967')
{
var ga = new GlideAjax('MyGroups');
ga.addParam('sysparm_name', 'isGrpMember');
ga.addParam('sysparm_userID', g_user.userID);
ga.addParam('sysparm_groupName',g_form.getValue('assignment_group'));
ga.getXML(hideField);
function hideField(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if ((answer == 'false') && !g_user.hasRole('admin')) {
g_form.setVariablesReadOnly(true);
}
else
{
g_form.setVariablesReadOnly(false);
}
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 12:38 AM
Hello Nag,
By default, an end user can also raise RITM.
If you want to know all non-admin users, then you can simply go to sys_user.list and then add a filter Roles is not admin. it will give you all non-admin users.
Mark answer as correct if this answers your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:26 AM
Hi Nag,
Did you check my solution given above?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:59 AM
Hi Asif
My requirement is : I have 4 catalog items, all the items have same "grid task" is generated in ritm as first, Once the task changes to closed complete the variables tab on ritm form should be read only for all the users except the ADMINS and Y Group members.
For this i wrote script include and client script , I dont know whether its working properly are not, Could please check it once and let me know if any changes are their
If is there any way to do the above requirement please provide the solution
Script include
var MyGroups = Class.create();
MyGroups.prototype = {
isGrpMember : function() {
var userID = this.getParameter('sysparm_userID');
var groupName = this.getParameter('sysparm_groupName');
var thisUser = gs.getUser().getUserByID(userID);
if (thisUser.isMemberOf(groupName)) {
return true;
}
else {
return false;
}
},
} type:'MyGroups';
Client script on ritm table
function onLoad() {
//Type appropriate comment here, and begin script below
var item=g_form.getValue('cat_item');
if (item=='e7d48d55db5f8b00c77b7016bf96199b' || item=='e386bfb3dba68700c77b7016bf961943' || item =='ae244264dbb6c700c77b7016bf961944' || item== '1813429bdb83c700f3e5f156bf9619e9' || item== '0d0c3f5adb28e3001ac0105f6896198e' || item =='f2377d15db9f8b00c77b7016bf96191c' || item=='f477b155db9f8b00c77b7016bf961967')
{
var ga = new GlideAjax('MyGroups');
ga.addParam('sysparm_name', 'isGrpMember');
ga.addParam('sysparm_userID', g_user.userID);
ga.addParam('sysparm_groupName',g_form.getValue('assignment_group'));
ga.getXML(hideField);
function hideField(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if ((answer == 'false') && !g_user.hasRole('admin')) {
g_form.setVariablesReadOnly(true);
}
else
{
g_form.setVariablesReadOnly(false);
}
}
}
}