HR Criteria - User criteria Script issue in HRSD

Harsha1
Tera Contributor

Hi Community,

I have issue with script.

1 .I have one group. I want to visible Record Producer only that Group. So that I make Hr Criteria - Business Unit- XYZ and set Group. But other BU - XYZ( which is not available that group ) also can see RP. (Available for)

2. So that I again make HR Criteria  BU - XYZ. (Set - Not Available for)

after that it is not visible to group as well as BU- XYZ

Group also have same Business unit. both the HR criteira are overriding.

Then I write script But it is also not working

Tried Options

1. 

answer = (function() {
var currentUser = gs.getUserID();
var userGr = new GlideRecord("sys_user");
userGr.get(currentUser);

if (userGr.u_job_business_unit == '174c4dd9db2c5f00363190b8db961927') {

if (gs.getUser().isMemberOf('Pakistan Resourcing')) {
return true;
} else {
return false;
}
}
return false;
})();

 

2. 

answer = (function() {
var currentUser = gs.getUserID();
var userGr = new GlideRecord("sys_user");
userGr.get(currentUser);

 

if (userGr.u_job_business_unit == '174c4dd9db2c5f00363190b8db961927' && gs.getUser().isMemberOf('Pakistan Resourcing')) {
return true;
}
return false;
})();

 

Please help me with these issue.

Regards,

Harsha 

2 REPLIES 2

Shruti
Mega Sage
Mega Sage

 

Hi, 

Please try with below script

1. 

answer = (function() {
var userGr = new GlideRecord("sys_user");
userGr.get(user_id);

if (userGr.u_job_business_unit.sys_id == '174c4dd9db2c5f00363190b8db961927') {

if (gs.getUser().isMemberOf('Pakistan Resourcing')) {
answer= true;
} else {
answer= false;
}
}
answer= false;
})();

 

2. 

answer = (function() {
var userGr = new GlideRecord("sys_user");
userGr.get(user_id);

 

if (userGr.u_job_business_unit.sys_id == '174c4dd9db2c5f00363190b8db961927' && gs.getUser().isMemberOf('Pakistan Resourcing')) {
answer= true;
}
answer=false;
})();

 

Hi StarK,

Thank you for your response.

I tried but it is no working.

Regards,

Harsha