User criteria referencing HR criteria

alipia123
Tera Contributor

hi all - for a while I have been creating HR criteria and then a related user criteria by clicking on the related link which gives me a user criteria with the script "

new sn_hr_core.hr_Criteria().evaluateById("(HR criteria sys ID", user_id);
Now these are throwing up scan findings and I need to find a different way of creating these user criteria.  Its been suggested to me that creating a systems property for that HR criteria and referencing it in the user criteria is the way to go but I am struggling to find the correct script within the user criteria to get it to work?  Can anyone share any tips?
1 ACCEPTED SOLUTION

Nolan Thaxton
ServiceNow Employee
ServiceNow Employee

Hello, 

Can you please share any scripts you have tried for your system properties? suggested approach, create a string system property with the HR Criteria sys_id, then call it from the script in your user criteria record. 

View solution in original post

3 REPLIES 3

Nolan Thaxton
ServiceNow Employee
ServiceNow Employee

Hello, 

Can you please share any scripts you have tried for your system properties? suggested approach, create a string system property with the HR Criteria sys_id, then call it from the script in your user criteria record. 

Thankyou nolan since I messaged you this morning I have managed to get the user criteria to work with no scan findings - so I think I am all good!

alipia123
Tera Contributor

Thankyou for your quick response - this is an example of one I have tried that isnt working

 

var currentUserId = gs.getUserID();

new sn_hr_core.hr_Criteria().evaluateById(gs.getProperty("propertyname"), currentUserId);

 

The property itself is in the sys_properties table and is a string type property that links to the SYS ID of the HR criteria