Advanced Reference isn't working on catalog variable

0890KM
Tera Contributor

Hey All, 

 

 

I feel that I am missing something and I'm not sure what it is. 


Here's my advanced reference qualifier on my catalog variable reference the sys_user table. 

javascript: new getGroupMembers().getGroupMembersForIT(current.variables.assignment_group);

 

 

Here's the script include, which is global, client callable. 

var getGroupMembers = Class.create();
getGroupMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {

            getGroupMembersForIT: function(assignmentGroup) {
                var arr = [];
                var grp = new GlideRecord('sys_user_grmember');
                grp.addQuery("group", assignmentGroup);
                grp.query();

                while (grp.next()) {
                    arr.push(grp.sys_id.toString());
					//gs.info("This are the values for the arr: " + arr);

                }

                return 'sys_idIN' + arr.toString();

            },

            type: 'getGroupMembers'
});

What am I doing wrong?

1 ACCEPTED SOLUTION

Chaitanya ILCR
Kilo Patron

You are returning sysids of group members table 

But you should return user sysids

 

var getGroupMembers = Class.create();
getGroupMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {

            getGroupMembersForIT: function(assignmentGroup) {
                var arr = [];
                var grp = new GlideRecord('sys_user_grmember');
                grp.addQuery("group", assignmentGroup);
                grp.query();

                while (grp.next()) {
                    arr.push(grp.user.toString());
					//gs.info("This are the values for the arr: " + arr);

                }

                return 'sys_idIN' + arr.toString();

            },

            type: 'getGroupMembers'
});

Try this

 

 

Regards

Chaitanya 

View solution in original post

6 REPLIES 6

DrewW
Mega Sage
Mega Sage

Did you add the "ref_qual_elements=assignment_group" to the var that uses the script?  Also did you make sure your script include is returning the expected value?

 

Chaitanya ILCR
Kilo Patron

You are returning sysids of group members table 

But you should return user sysids

 

var getGroupMembers = Class.create();
getGroupMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {

            getGroupMembersForIT: function(assignmentGroup) {
                var arr = [];
                var grp = new GlideRecord('sys_user_grmember');
                grp.addQuery("group", assignmentGroup);
                grp.query();

                while (grp.next()) {
                    arr.push(grp.user.toString());
					//gs.info("This are the values for the arr: " + arr);

                }

                return 'sys_idIN' + arr.toString();

            },

            type: 'getGroupMembers'
});

Try this

 

 

Regards

Chaitanya 

It still didn't work for me. The ONLY thing that is giving me any results is adding "sys_idIN" to the advanced reference qualifier within the catalog variable, but it doesn't return a result, the pop-up view is blank. 

Hi @0890KM ,

 

the script works for me

 

ChaitanyaILCR_0-1747399379863.png

 

is the variable assignment_group is populated?

can you share more details of these variables assignment_group and user variable 

screenshots of variables? types and references sections 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya