Script to evaluate user Vs, user criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 12:46 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 02:06 AM
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.");
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 01:40 PM
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!