Notifications

480 views

Symptoms


When using the is (dynamic) one of my groups filter on a glide list referencing sys_user_group, the condition evaluates to false if the list field has more than one value

Release


All 

Cause


This is expected behavior as the dynamic filter One of My groups only expects a single reference and when a glide list field has more than one item it would be sending two references. 

Resolution 


 

You can manually script the condition to check if you are a member of the groups in a Glide List using an array loop.

Here is an example from our Docs on how you can get and loop through the values in a glide list. 
https://docs.servicenow.com/bundle/kingston-application-development/page/script/business-rules/reference/r_ReferencingAGlideListFromAScript.html
 
Then you just need to run each sys_id returned against the isMemberOf() function for your user object.
https://docs.servicenow.com/bundle/london-application-development/page/app-store/dev_portal/API_reference/GlideUser_global/concept/GUserAPI.html#ariaid-title15
 
 
Example:
var currentUser = gs.getUser();
var list = current.my_group_list.getDisplayValue(); var array = list.split(","); for (var i=0; i < array.length; i++) {

if(currentUser.isMemberof(array[i]){
return true;
}
}

return false;
 

Article Information

Last Updated:2018-08-21 23:01:48
Published:2018-08-20