Not applicable

This is the code I got working in the end. 

 

var userName = new GlideRecord('sys_user');
userName.addQuery('sys_id', gs.user_id());
userName.query(); // Get logged in user record

while (userName.next()) {
    var userLoc = userName.location.cmn_location_type; //Get user locaiton type
    var grMem = new GlideRecord('sys_user_grmember');
    grMem.addQuery('user', gs.user_id());
    grMem.query(); // Find users groups

    while (grMem.next()) { //Iterate though associated users' groups
        if (userLoc == 'Ship' && grMem.group.name.indexOf("Onboard IT") === -1) { //Check user location type is Ship
            answer = true;
        } else {
            answer = false;
        }
    }
}

 

 

View solution in original post