Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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
Mega 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

I just had to redo it. I think there was something wrong with my update set. I backed it out and now it is working! 

 

Thanks!

Cool @0890KM ,

Glad it's working now

 

Could you please accept the appropriate response as a solution and close the thread 

it will help for the future readers

 

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

Regards,
Chaitanya