Script to evaluate user Vs, user criteria

Eli Guttman
Tera Guru

Hi,

 

In Human source scoped application, there is script include called hr_UserCriteriaEvaluation with function of  checkUserMeetsUserCriteria - this function get user_id and HR criteria ID and return if the user meet the criteria. 

 

is there similar function for regular user criteria? someone on the global scope.

2 REPLIES 2

Riya Verma
Kilo Sage
Kilo Sage

Hi @Eli Guttman ,

 

Hope you are doing great.

 

There is no specific built-in function designed explicitly for evaluating user criteria in the global scope. One approach is to utilize the GlideUser object and its associated methods to evaluate user criteria.

var currentUser = gs.getUser();


var criteria = "criteria_goes_here";

var meetsCriteria = currentUser.<methodToEvaluateCriteria>(criteria);

if (meetsCriteria) {
   // User meets the criteria
   gs.log("The user meets the specified criteria in the global scope.");
} else {
   // User does not meet the criteria
   gs.log("The user does not meet the specified criteria in the global scope.");
   
}
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Thank you Riya.

 

I think i'm looking for the methodToEvaluateCriteria. Do you know if there is anything in the GlideUser object that can help?

 

Thanks again!