- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 07:26 AM
Hi All,
I have written a script include that needs to be called in BR. The script include will pick up the current user role and return true it role is 'Priority_override' or will return false.
How can we call this in a BR , I need to run another action in the BR if that Script include returns false.
Can you give some inputs please
Regards,
VASS
var prioritycheck = Class.create();
prioritycheck.prototype = {
initialize: function() {
},
priorityoverride: function() {
var rol = new GlideRecord('sys_user_role');
rol.addQuery('name', 'priority_override');
rol.query();
if (rol.next()) {
var hasRole = new GlideRecord('sys_user_has_role');
gs.addInfoMessage('no of rows..'+rol.getRowCount());
hasRole.addQuery('user', gs.getUserID());
gs.getUserID();
hasRole.addQuery('role', rol.sys_id);
hasRole.query();
if (hasRole.next()) {
return true;
}
else {
return false;
}
}
},
type: 'prioritycheck'
};
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 07:30 AM
var priorityCheck = new prioritycheck();
var override = priorityCheck.priorityoverride();
if(override){
// do stuff;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 07:29 AM
Hi,
this might help you
https://community.servicenow.com/community?id=community_question&sys_id=a600c321db98dbc01dcaf3231f961905
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 07:30 AM
var priorityCheck = new prioritycheck();
var override = priorityCheck.priorityoverride();
if(override){
// do stuff;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 09:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 09:29 AM
there was a typo in the code. In the line 4 it should be a Upper case 'C'
var override= priorityCheck.priorityoverride();