To check logged in user is a manager on the basis of any other variable value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 10:45 AM
Hi Community,
I have a requirement in which i need to check logged in user is a manager or not based on a field value.
If xyz is "No" then i need to check logged in user is manager or not.
Is this possible? If yes, then please provide me the code for the same.
Thanks,
Poorva Bhawsar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 10:43 PM
In Before update you can use below code
if(current.impact==3) { // ex xyz=NO
if (gs.getUser().hasRole('sn_audit.manager')) {
gs.addInfoMessage("In Manager Loop-------");
//current.addEncodedQuery('impact=3');
}
}
If it is Before Query then below code will work
var num = current.getTableName();
var gr = new GlideRecord(num);
gr.addEncodedQuery('impact=3'); //XYZ=No
gr.query();
while (gr.next()) {
gs.addInfoMessage("In Low Impact*************"+gr.getRowCount());
if (gs.getUser().hasRole('sn_audit.manager')) {
gs.addInfoMessage("In Manager Loop-------");
//current.addEncodedQuery('impact=3');
}
}
Please check and let me know if it helpful or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 10:48 PM
This is for a catalog item variable, I need a client script for this. Just if xyz has No then need to check logged in user is a manager or not.