Display reference choices based on the logged-in user role.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 09:31 PM
Hello all,
The reference variable field choice should be updated dependent on the logged-in user's role. However, my scripts below do not function. What might have gone wrong?
Field reference qualifier: javascript:new sn_hr_core.INQUtil().checkroleof();
//Script include
var INQUtil = Class.create();
INQUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkroleof: function() {
var TopicAre = '';
var reqbyuseris = gs.getUserID();
var chkuserrole = new GlideRecord('sys_user_has_role');
chkuserrole.addQuery('user', reqbyuseris);
chkuserrole.addQuery('role.name', 'sn_hr_core.basic');
chkuserrole.query();
if (chkuserrole.next()) {
TopicAre = 'nameINOption1,Option 2,Option 4^active=true';
} else {
TopicAre = 'nameINOption5,Option 6,Option 7^active=true';
}
return TopicAre;
},
type: 'INQUtil'
});
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 09:42 PM
Are you working or scoped application or global ?
If in global then tried the reference qualifier
javascript:new ScriptIncludeName().functionName();
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 09:50 PM
not global but human resource core