Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Reference qualifier not calling script include

Brijmohan
Tera Contributor

Hi, I have a requirement in catalog item. I have two variables "Search for people" and "Type keyword for search" based on this I want users should be display in reference fields called "search results" but it is showing all users.

I am using script include and advance reference qualifier but it is not working even no logs are showing in logs table.
Not sure what I am doing wrong.

getFilter: function(type, keyword, selectedUsers) {

        gs.info("GEVN_ONEIDM: type = " + type);
        gs.info("GEVN_ONEIDM: keyword = " + keyword);
        gs.info("GEVN_ONEIDM: selectedUsers = " + selectedUsers);

        if (!keyword || keyword=='' || keyword == 'undefined') {
            gs.info("GEVN_ONEIDM: No keyword entered");
            return 'sys_id=NULL';
        }

        var query = '';

        // SSO search
        if (type == 'sso') {
            query = 'user_nameLIKE' + keyword;
        }

        // First name / Last name search
        if (type == 'first_name_last_name') {
            query = 'first_nameLIKE' + keyword + '^ORlast_nameLIKE' + keyword;
        }

        // Email search
        if (type == 'email_address') {
            query = 'emailLIKE' + keyword;
        }

        // Manager search
        if (type == 'directly_reports_to') {

            gs.info("GEVN_ONEIDM: Searching manager using SSO");

            var mgr = new GlideRecord('sys_user');
            mgr.addQuery('user_name', keyword);
            mgr.setLimit(1);
            mgr.query();

            if (mgr.next()) {
                gs.info("GEVN_ONEIDM: Manager found = " + mgr.name);
                query = 'manager=' + mgr.sys_id;
            } else {
                gs.info("GEVN_ONEIDM: Manager NOT found");
                return 'sys_idISEMPTY';
            }
        }

        // Remove already selected users
        if (selectedUsers) {
            gs.info("GEVN_ONEIDM: Removing selected users");
            query += '^sys_idNOT IN' + selectedUsers;
        }

		if(!query){
			return 'sys_idISEMPTY';
		}

        gs.info("GEVN_ONEIDM FINAL QUERY: " + query);

        return query;
    },

 

 Reference qualifier in search result variable: 

javascript​: new global.GEVN_ONEIDM().getFilter(current.variables.v_search_for_people,current.variables.v_type_keyword_for_search,current.variables.v_people);

 

Screenshot 2026-03-12 003059.png
 
Regards,
Brij
13 REPLIES 13

yeah there is other function that is called from GlideAjax.

Hi @Brijmohan ,

Did that script include have ACL . If not create a client callable script include ACL with public role.

@NagaChandaE , yeah we have acl for it with snc_internal role.

NagaChandaE
Mega Sage

Hi @Brijmohan ,

NagaChandaE_0-1773309597577.png

 

Here Ref_ac_coloums attributes are those fields present in user table if not remove that .  

And script include and catalog item variable are in same scope so not required to call script include global.

Did that script include have ACL . If not create a client callable script include ACL with public role.

As you mentioned there is another script include function . is that calling properly . 

is this same for all users like admin.