Reference qualifier in not working

Avee90
Tera Contributor

Hello Folks,

     I've a requirement to not show the groups with no users in the assignment group field. For this I've written script script and used that in the task table's assignment group field advanced ref qualifier. But I'm trying this I'm getting the groups with users and the script include may be not calling. I'm giving the script and ref qualifier. Please help to correct this 🙂

Thanks,
Avee. 

7 REPLIES 7

Community Alums
Not applicable

Hi @Avee90 ,

Please try like javascript: new groupwithUser().getGroups() 

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

swathisarang98
Giga Sage
Giga Sage

Hi @Avee90 ,

 

I think the script include is not returning correct value could you please try below code ?

 

var getGroupWnoMem = Class.create();
getGroupWnoMem.prototype = {
    initialize: function() {},

    getGroup: function() {
        var gr = new GlideRecord('sys_user_group');
        gr.addActiveQuery();
        gr.query();

        var arr = [];
        while (gr.next()) {
            var grMember = new GlideRecord('sys_user_grmember');
            grMember.addQuery('group', gr.getValue('sys_id'));
            grMember.query();
            var count = grMember.getRowCount();
           // gs.info('RowCount' + count);
            if (count <= 0) {
                arr.push(gr.getValue('sys_id'));
            }

        }
      //  gs.info('array' + arr);
        return 'sys_idIN' + arr;
    },

    type: 'getGroupWnoMem'
};

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Sandeep Rajput
Tera Patron
Tera Patron

@Avee90 In your script include on Line number 14 you are incrementing a count variable which you have not defined previously. Due to this the script is crashing at liner number 14. Either define the count variable as var count = 0; before the loop or comment the line number 14 altogether. 

 

Hope this helps.