- 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:17 AM
Hi Nag,
Do you want how many users from sys_user table have admin and how many don't have admin?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:01 AM
Yes Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:14 AM
Hi Nag,
For this you can use filter on sys_user_has_role table
use filter as role is admin; you would get a list of records then you can export it in excel etc
similarly apply filter as role is not admin
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2019 02:59 AM
Hi Ankur
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);
}
}
}
}