how to find non admin user in service now

Nag9
Tera Expert

How to find non admin user in servicenow, he must have permissions to raise Ritm

1 ACCEPTED SOLUTION

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);

 

View solution in original post

93 REPLIES 93

Chck if you are getting any error in your browser console when you open the ticket.

also, share me your latest client script once.

this Latest client script,  Browse console means

 

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')
{
g_form.addInfoMessage("Entered into if condition");
var ga = new GlideAjax('MyGroups');
ga.addParam('sysparm_name', 'isGrpMember');
//ga.addParam('sysparm_userID', g_user.userID);
ga.addParam('sysparm_userID', g_user.userName);
ga.addParam('sysparm_groupName',g_form.getValue('assignment_group'));
ga.getXML(hideField);
function hideField(response) {
var answer = response.responseXML.documentElement.getAttribute('answer').toString();
g_form.addInfoMessage("Entered into the function" +answer);
g_form.addInfoMessage(g_user.hasRole('admin'));
if ((answer == 'false') && !g_user.hasRole('admin')) {
g_form.setVariablesReadOnly(true);
}
else
{
g_form.setVariablesReadOnly(false);
}
}
}

}

 

this Latest client script,  Browse console means

 

Right click on the window anywhere in browser, then you see inspect which opens a small window. In that look for console tab and see the error.

 

And in the client script, just place these lines in the beginning of the function hideField and then check.

g_form.addInfoMessage("Entered into the function" +answer);
g_form.addInfoMessage(g_user.hasRole('admin'));

This is the out put im getting

 

find_real_file.png

So its working now.

Your script include has returned false, becuase the user is not member of the group.

but the current user is admin.

So check as a non-admin once.