I think that because you are running your script in the HR Scope, the gs.getUser() method is not working. I have seen similar issues when trying to run gs methods when calling them outside the scope of the include. Since we cannot use that method, I just wrote what it does in that function within the script include. Here are the new details for the script include:


var usrUtilsAjax = Class.create();


usrUtilsAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {



      /**


        * Checks to see if a user is a member of a group


        *


        * @param           {string}   sysparm_grp   The sys_id or name of the group to check


        * @param           {string}   sysparm_usr   The sys_id of the User to check


        * @return         {boolean}   Returns true if the user is a member of the group,


        *                                               otherwise returns false


        */


      chkIsMember: function() {


              var grpID = this.getParameter('sysparm_grp');


              var usrID = this.getParameter('sysparm_usr');


              var memObj = new GlideRecord('sys_user_grmember');


              var qString = 'group=' + grpID + '^user=' + usrID;


              memObj.addEncodedQuery(qString);


              memObj.query();


              return memObj.hasNext();


      },



      type: 'usrUtilsAjax'


});



Hopefully this will work.


View solution in original post