Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to call script include in BR?

vass2
Mega Expert

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

find_real_file.png

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'
};

 

1 ACCEPTED SOLUTION

Dubz
Mega Sage

var priorityCheck = new prioritycheck();

var override = priorityCheck.priorityoverride();

if(override){

// do stuff;

}

View solution in original post

8 REPLIES 8

Naveen4
Kilo Guru

Hi,

 

this might help you

https://community.servicenow.com/community?id=community_question&sys_id=a600c321db98dbc01dcaf3231f961905

Dubz
Mega Sage

var priorityCheck = new prioritycheck();

var override = priorityCheck.priorityoverride();

if(override){

// do stuff;

}

Hi David,

I am getting override is 'undefined ' error, when i run the BR

 

there was a typo in the code. In the line 4 it should be a Upper case 'C' 

var override= priorityCheck.priorityoverride();